rafaelmaeuer
8/9/2017 - 4:40 PM

JavaScript ES6 promise for loop - From https://stackoverflow.com/questions/40328932/javascript-es6-promise-for-loop

(async function loop() {
    for (let i = 0; i <= 10; i++) {
        await new Promise(resolve => setTimeout(resolve, Math.random() * 1000));
        console.log(i);
    }
})();