Promise.all=(proArr) =>{
return new Promise((resolve, reject) => {
let retsult = []
let count = 0
for (let i = 0; i < proArr.length; i++) {
proArr[i].then(data => {
retsult[i]=data
if(++count===proArr.length){
resolve(retsult)
}
}, reject)
}
})
}
Promise.race=(promiseAry)=> {
return new Promise((resolve, reject) => {
for (let i = 0; i < promiseAry.length; i++) {
promiseAry[i].then(resolve, reject)
}
})
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。