Junior — Senior
Creating your own Promise.all
livecode
Task condition
Implement a function that mimics the behavior of Promise.all. The function should accept an array of promise objects and return a new promise. This promise should resolve with an array of values obtained from all the passed promises, or reject immediately upon any of them failing, passing the reason of the first failure.
Example usage:
customAll([p1, p2, p3])
.then(results => console.log(results))
.catch(err => console.error(err));