Created
December 7, 2018 08:30
-
-
Save doxas/bfb57154f63a4c5bb212325687ffc6ab to your computer and use it in GitHub Desktop.
testing async/await in `for` statement
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
(async () => { | |
let v = 0; | |
for(let i = 0; i < 10; ++i){ | |
x = await ((index) => { | |
setTimeout(() => { | |
console.log('🔥'.repeat(index + 1)); | |
}, index * 500); | |
return index * index; | |
})(i); | |
console.log(x); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment