Created
May 17, 2020 20:23
-
-
Save josser/6dc51db1bfba39520f6824b737193dfd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function timedLog(value, ms) { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
console.log(value) | |
resolve() | |
}, ms) | |
}) | |
} | |
async function doSomething() { | |
let arr = [300, 200, 100] | |
for (let i of arr) { | |
await timedLog(i, i) | |
} | |
} | |
doSomething() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment