allSettled < Promise < JavaScript
The Promise allSettled() static method takes an iterable of promises and returns a single Promise. This returned promise fulfills when all of the input's promises settle with an array of objects that describe the outcome of each promise.
const promise1 = Promise.resolve(3);
const promise2 = new Promise((resolve, reject) =>
setTimeout(reject, 200, 'foo'),
);
Promise.allSettled([promise1, promise2]).then((results) =>
results.forEach((result) => console.log(result.status)),
);
// "fulfilled"
// "rejected"