Answers for "loop through async javascript -IMP"

0

loop through async javascript -IMP

function someFunction() {
     let promises = [];
     for (let i = 0; i < 10; i++) {
          promises.push(asynchonousProcessThatReturnsPromise());
     }
     return Promise.all(promises);
 }

 someFunction().then(results => {
     // array of results in order here
     console.log(results);
 }).catch(err => {
     console.log(err);
 });
Posted by: Guest on September-08-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language