1
0
Fork 0
mirror of https://gitlab.com/mfocko/LeetCode.git synced 2024-09-19 01:36:57 +02:00
LeetCode/js/sleep.js

14 lines
273 B
JavaScript
Raw Permalink Normal View History

/**
* @param {number} millis
*/
async function sleep(millis) {
return new Promise((resolve, reject) => {
setTimeout(() => resolve('Slept enough!'), millis);
});
}
/**
* let t = Date.now()
* sleep(100).then(() => console.log(Date.now() - t)) // 100
*/