📜  节点 js 异步运行 for 循环 - Javascript 代码示例

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

代码示例1
const Output = [];

for await (const item of List) {
      let result = await someAsyncFunction(item);
    Output.push(result);
};

res.status(200).json(Output); // response is sent after the loop is finished