16 ms·
const sleep = ms => new Promise(r => setTimeout(r, ms)); It doesn't need to be that tricky.
by junon 6y ago
const sleep = ms => new Promise(r => setTimeout(r, ms));
It doesn't need to be that tricky.
- eloff 6y agoI get that the arrow function notation is less verbose, but I disagree with calling function syntax "tricky". It really doesn't matter much. You need the type on ms though (if using typescript), and export.