Answers for "promise in forloop"

2

promise in forloop

(async function loop() {
    for (let i = 0; i < 10; i++) {
        await new Promise(resolve => setTimeout(resolve, Math.random() * 1000));
        console.log(i);
    }
})();
Posted by: Guest on August-19-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language