Last active
October 9, 2017 13:15
-
-
Save rafaelmaeuer/924584d856e0fd897e2e287824da3eaf to your computer and use it in GitHub Desktop.
JavaScript ES6 promise for loop - From https://stackoverflow.com/questions/40328932/javascript-es6-promise-for-loop
This file contains 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 function loop() { | |
for (let i = 0; i <= 10; i++) { | |
await new Promise(resolve => setTimeout(resolve, Math.random() * 1000)); | |
console.log(i); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment