
Promise.allSettled() – Waits for all promises to settle, giving an array of result objects with status and value/reason.
๐ Syntax
Promise.allSettled([p1, p2]).then(results => {
// status: 'fulfilled' or 'rejected'
});
๐งช Example
Promise.allSettled([
Promise.resolve(1),
Promise.reject('err')
]).then(console.log);
Comments
Post a Comment