iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Use Promise.allSettled() when you need every operation to finish and want to inspect each result. Use Promise.any() when the first successful result is enough. Use Promise.race() when the first result of any kind—success or failure—should settle the combined promise. None of these methods cancels unfinished operations.
How the three promise combinators differ
The key distinction is what counts as the winner: every outcome, the first fulfillment, or the first settlement. A promise is fulfilled when it succeeds and rejected when it fails; either state means it is settled.
| Method | When the combined promise settles | What it fulfills with | What happens on rejection | Best fit |
|---|---|---|---|---|
Promise.allSettled(iterable) |
After every input settles | An array of outcome records, one per input | Individual rejections appear as records; they do not ordinarily reject the combined promise | Independent work where you need a complete success-and-failure report |
Promise.any(iterable) |
On the first fulfillment, or after all inputs reject | The value from the first fulfilled input | Rejects with an AggregateError if every input rejects |
Redundant alternatives where any successful result is acceptable |
Promise.race(iterable) |
As soon as the first input settles, whether fulfilled or rejected | The first settled input’s fulfillment value | Rejects with the first input’s rejection reason | First-result behavior, including cases where an early failure should win |
Each method accepts an iterable. Values and thenables are assimilated by the promise machinery. The methods decide how the aggregate promise responds to the inputs; they do not start all work in parallel or control how that work runs. The operations may already be running when you pass their promises to a combinator. MDN describes Promise.race() as “one of the promise concurrency methods” in its Promise.race() reference.
Free tools Windows power users keep installed
One-click scans. No signup required.
Choose based on what your caller needs
Use allSettled when you need every outcome
Promise.allSettled() waits for every input, then fulfills with an array of records. Each record has a status of "fulfilled" or "rejected". Read value only from fulfilled records and reason only from rejected ones.
#1 Best Overall
const outcomes = await Promise.allSettled(tasks);
const failures = outcomes.filter((result) => result.status === "rejected");
This is useful when partial success still matters: for example, when a screen loads several independent panels and should show the panels that worked while identifying those that failed. If any rejection should instead make the combined operation fail, Promise.all() is the more appropriate choice; MDN’s Promise reference documents the available combinators.
Use any when the first success is enough
Promise.any() fulfills as soon as one input fulfills. An earlier rejection does not win while another input might succeed. This makes it suitable for trying interchangeable sources, such as a primary service and backups.
Rank #2
try {
const bestAvailable = await Promise.any([
primary(),
backupA(),
backupB(),
]);
} catch (error) {
if (error instanceof AggregateError) {
// Every alternative rejected; inspect error.errors.
}
}
If all inputs reject, the combined promise rejects with an AggregateError containing the rejection reasons. An empty iterable also rejects with AggregateError. See MDN’s Promise.any() reference.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Use race when the first settlement should decide
Promise.race() adopts the outcome of whichever input settles first. A fast rejection therefore beats a slower fulfillment. If your question is “How do I return as soon as any of the promises settles?”, race is the direct answer—not any, which waits past rejections for a possible success.
const result = await Promise.race([primary(), backup()]);
Use race only when either the first success or the first failure should settle the wrapper. If a fast failure should be ignored while alternatives continue, use any instead. MDN’s Promise.race() reference describes its first-settled behavior.
What happens with empty inputs?
An empty iterable exposes each method’s completion rule:
Rank #4
| Call | Result | Why |
|---|---|---|
Promise.allSettled([]) |
Fulfills with [] |
There are no inputs left to wait for |
Promise.any([]) |
Rejects with AggregateError |
No input can fulfill |
Promise.race([]) |
Remains pending | No input can settle the race |
These are defined semantics, not timing-dependent outcomes; the method definitions are in the June 2023 14th edition of ECMA-262.
A race does not cancel the losing operation
When Promise.race() settles, the other operations continue unless they have their own cancellation mechanism. The same principle applies to Promise.any(): returning the first successful result does not stop remaining work. A timeout race alone can leave both the request and timer running.
Best Value
For a fetch timeout, use an AbortController to cancel the request when the timeout wins, and clear the timer if the fetch wins. Cancellation and cleanup belong to the underlying operations, not to the promise combinator. The MDN method references for any and race explain that inputs are handled as part of the combinator; losing rejections are not automatically unhandled merely because another input settled first.
Quick Recap
Quick decision guide
- Need all tasks to finish and a record of successes and failures? Choose
Promise.allSettled(). - Need one successful answer, while treating rejections as failed attempts? Choose
Promise.any(). - Need whichever input settles first, including a rejection? Choose
Promise.race(). - Need any rejection to reject the whole group? Consider
Promise.all(). - Need unfinished work to stop? Add explicit cancellation or cleanup; no combinator does that automatically.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

