SOURCE

function mypromiseAll(promiseArray){
    return new Promise((resolve,reject)=>{
        if(!Array.isArray(promiseArray)){
           reject('not a array')
        }
        let len = promiseArray.length;
        let valueList = new Array(len).fill(0);//存放返回值
        let index = 0;
        for(let promi of promiseArray){
            Promise.resolve(promi).then((res)=>{
                valueList[i] = res;
                index++;
                if(index==len){
                    resolve(valueList);
                }
            })   
        }
    })
}
console 命令行工具 X clear

                    
>
console