📜  等待循环完成 javascript 代码示例

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

代码示例1
async function processArray(array) {
  // map array to promises
  const promises = array.map(delayedLog);
  // wait until all promises are resolved
  await Promise.all(promises);
  console.log('Done!');
}