SOURCE

Promise.all = function (ietrator) {
    let count = 0;
    const length = iterator.length;
    const red = [];
    return new Promise(function(resolve,reject){
        for(let item of ietrator) {
            new Promise.resolve(item).then((data) => {
                try {
                    count++
                    res[count] = item;
                    if(count === length){
                        resolve(res)
                    }
                } catch (e) {
                    reject(e)
                }
            })
        }
    })
}
console 命令行工具 X clear

                    
>
console