ForgeFrontend — Prepare, Practice, Crack
Secure checkout
Lifetime access
Instant Drive delivery
Free updates forever

Prepare · Practice · Crack

Promise.all vs allSettled vs race vs any?

Quick answer

all: reject on first failure. allSettled: wait for every result. race: first to settle. any: first to fulfil.

In detail

`all` resolves with all values but short-circuits to reject on the first rejection. `allSettled` never rejects — it returns {status, value|reason} per promise. `race` settles as soon as any one settles (good for timeouts). `any` resolves with the first fulfilment, rejecting only if all reject.

await Promise.all([a, b]);        // all succeed or throw
await Promise.allSettled([a, b]); // every outcome
await Promise.race([task, timeout]); // first to settle

💡Pick by intent

Everything must succeed → all. Need every outcome → allSettled. Timeout → race.

Why interviewers ask this: Tests practical command of concurrent async.

This is 1 of 118+ questions in the JavaScript Interview Kit

Get every question with detailed answers, follow-ups and real code — plus coding challenges and a last-minute revision sheet. One-time payment, instant access.

⚡ Get the JavaScript Interview Kit → ₹299

Full kit

JavaScript Interview Kit · ₹299

Get it →