十条请求并发那个,不知道我这样写对不对?或者思路是不是对的?平时都没接触过这种类似的问题,刚刚花了十几分钟写的,感觉要裂开。。 const promiseList = [] for (let i = 0; i < 10; i++) { promiseList.push(Promise.resolve(i)) } const doPromise = async (promiseList) => { let actionList = [] let num = 0 let pListLength = promiseList.length for (p in promiseList) { actionList.push(p) num += 1 pListLength -= 1 if (num === 3 || pListLength === 0) { await Promise.all(actionList).then(console.log) num = 0 actionList = [] } } } doPromise(promiseList)
点赞 评论

相关推荐

待现的未见之事:起码第一句要把自己的优势说出来吧。比如什么xx本27届学生,随时到岗....
点赞 评论 收藏
分享

牛客热帖

更多
牛客网
牛客企业服务