SOURCE

Promise.myAll = (promises)=>{
    return new Promise(resolve,reject=>{
        let count = 0;
        let result = [];
        let len = promises.length;
        if(len==0){
            resolve([])
        }
        for(let i = 0;i<len;i++){
         Promise.resolve(promises[i]).then(res=>{
              count +=1;
              result[i] = res;
              if(count==len){
                  resolve(result)
              }
         }).catch(err=>{
             reject(err)
         })
        }
    })
}
console 命令行工具 X clear

                    
>
console