SOURCE

export const all = (promiseArr) => {
    let  result = []
    let count = 0
    return new myPromise((resolve, reject)=> {
        for(let i = 0; i < promiseArr.length; i ++){
            Promise.resolve(promiseArr[i]).then(
                (res) => {
                    result[i] = res;
                    count++
                    if(count === promiseArr.length){
                        resolve(result)
                    }
                },
                (err) =>{
                    reject(err)
                }
            )
        }
    })
}
console 命令行工具 X clear

                    
>
console