Implement a function promiseAllSettled(promises) that accepts an array of promises (or values) and returns a promise that resolves when all of them have settled.
The returned promise should resolve to an array of objects representing the outcome of each input:
{ status: 'fulfilled', value: result }.{ status: 'rejected', reason: error }.Examples
const p1 = Promise.resolve(1); const p2 = Promise.reject('err'); const p3 = 3; await promiseAllSettled([p1, p2, p3]); // [ // { status: 'fulfilled', value: 1 }, // { status: 'rejected', reason: 'err' }, // { status: 'fulfilled', value: 3 } // ]
JavaScript Function
No test results yet
Click "Run" to execute tests