Junior — Senior
Independent implementation of a function similar to Promise.all
livecode
Task condition
It is necessary to write your own promiseAll function that behaves the same as Promise.all.
Requirements for implementation:
- The function takes an array of promises as an argument.
- If at least one of the provided promises is rejected, the function should return a rejected (reject) promise.
- If all the provided promises are successfully resolved, the function should return a resolved (resolve) promise.
- Upon successful completion, the order of elements in the resulting array should match the order of the original promises.
- When the first error occurs, the function should immediately reject the result without waiting for the other promises to complete.