1 function someFunction() {
2 let promises = [];
3 for (let i = 0; i < 10; i++) {
4 promises.push(asynchonousProcessThatReturnsPromise());
5 }
6 return Promise.all(promises);
7 }
8
9 someFunction().then(results => {
10 // array of results in order here
11 console.log(results);
12 }).catch(err => {
13 console.log(err);
14 });
15