📜  async await forEach - Javascript 代码示例

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

代码示例6
Array.prototype.forEachAsync = async function (fn) {
    for (let t of this) { await fn(t) }
}

Array.prototype.forEachAsyncParallel = async function (fn) {
    await Promise.all(this.map(fn));
}