function Gen (time) { return new Promise((resolve,reject) => { setTimeout(function () { resolve(time) },time) }) } async function test () { let arr = [Gen(2000),Gen(100),Gen(3000)] for await (let item of arr) { console.log(Date.now(),item) } } test()
for await of异步操作集合遍历
猜你喜欢
转载自www.cnblogs.com/qjb2404/p/12231570.html
今日推荐
周排行