Junior — Senior
Independent implementation of a function similar to Promise.all
livecode
Task condition
It is required to write your own promiseAll function that reproduces the behavior of the standard Promise.all.
Requirements:
- The function takes an array of promises as input.
- If at least one of the promises is rejected, it should immediately return a rejected promise.
- If all promises are successfully resolved, it should return a promise resolved with an array of results.
- When successfully completed, the order of elements in the resulting array should match the order of the original promises.
- When any promise is rejected, the rejection should occur instantly, without waiting for the other promises to settle.