Sobes.tech
Junior — Senior

Implementation of a custom Promise.all analog

livecode

Task condition

You need to write a polyfill for the static method Promise.all. The function should accept an array of promises and return a new promise that resolves with an array of the received values or rejects if any of the passed promises fail.

function myPromiseAll(promisesArray) {
    // implementation
}

Example usage:

myPromiseAll([p1, p2, p3]).then(results => {
    // handle results
});