SOURCE

Promise.all = (promises) => {
    return new Promise((resolve, reject) => {
        const len = promises.length;
        const resultArr = [];

        for(let i = 0; i < len; i++) {
            promises[i].then(() => {
                resultArr.push(value);
            }, () => {
                reject(reason)
            })
        }

        resolve(resultArr)
    }) 
}
console 命令行工具 X clear

                    
>
console