← Back to Coding Challenges
● CLIENT SANDBOX ISOLATED
◐MED
#javascript#promises#async
Implement Promise.all Polyfill
Write a custom implementation of `promiseAll` that accepts an array of values (which may or may not be promises) and returns a promise.
- It resolves when all elements resolve, with an array of their values in the same order.
- If any promise rejects, it rejects immediately with the error.
- If passed an empty array, it resolves with an empty array.
CONSTRAINTS
Do not use Promise.all or Promise.allSettled natively in your implementation.
TEST SPECIFICATIONS (2)
INPUT: [[1,2,3]]
EXPECTED: [1,2,3]
INPUT: [[]]
EXPECTED: []
solution.js
INITIALIZING MONACO EDITOR...