Skip to content

Instantly share code, notes, and snippets.

@josser
Created May 17, 2020 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josser/6dc51db1bfba39520f6824b737193dfd to your computer and use it in GitHub Desktop.
Save josser/6dc51db1bfba39520f6824b737193dfd to your computer and use it in GitHub Desktop.
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