📌  相关文章
📜  循环通过异步 javascript -IMP - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:09.582000             🧑  作者: Mango

代码示例1
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);
 });