Skip to content

Instantly share code, notes, and snippets.

@doxas
Created December 7, 2018 08:30
Show Gist options
  • Save doxas/bfb57154f63a4c5bb212325687ffc6ab to your computer and use it in GitHub Desktop.
Save doxas/bfb57154f63a4c5bb212325687ffc6ab to your computer and use it in GitHub Desktop.
testing async/await in `for` statement
(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