Promise.all vs Promise.allSettled
Both run promises concurrently, but they handle failures very differently.
The difference
Promise.all resolves with all values but REJECTS on the first failure (short-circuits). Promise.allSettled waits for every promise and NEVER rejects — it returns { status, value | reason } for each.
await Promise.all([a, b]); // all succeed, or throw on first fail
await Promise.allSettled([a, b]); // every outcome, never throwsWhen to use each
Use Promise.all when everything must succeed and one failure should abort. Use allSettled when you want every result regardless of individual failures — e.g. loading several independent widgets.
Master async JavaScript
Promise combinators, async/await, the event loop and async coding problems — in the JavaScript Interview Kit.
⚡ Get the JavaScript Interview Kit → ₹299Frequently asked questions
- What about race and any?
- race settles as soon as any one settles (good for timeouts); any resolves with the first fulfilment, rejecting only if all reject.
- Which should I use for parallel fetches?
- all if they're all required; allSettled if you want partial results even when some fail.
