1
0
Fork 0
mirror of https://gitlab.com/mfocko/LeetCode.git synced 2024-11-09 15:59:06 +01:00

problems(js): add “2621. Sleep”

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2023-05-18 19:42:47 +02:00
parent ac8a1720ef
commit d5c96c6a21
Signed by: mfocko
GPG key ID: 7C47D46246790496

13
problems/sleep.js Normal file
View file

@ -0,0 +1,13 @@
/**
* @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
*/