Promise.any()Baseline · Widely available
The Promise.any() static method returns a promise that fulfills as soon as the first of an iterable of promises fulfills, with that promise's value. Otherwise, it rejects with an AggregateError when all of the promises have rejected.
Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Sep 16, 2020. Widely available since Mar 16, 2023.
Browser support
DesktopChrome
1–84Not supported
85+Supportedsince Aug 25, 2020
Current: 155Edge
12–84Not supported
85+Supportedsince Aug 27, 2020
Current: 154Firefox
1–78Not supported
79+Supportedsince Jul 28, 2020
Current: 157Safari
1–13.1Not supported
14+Supportedsince Sep 16, 2020
Current: 27MobileChrome Android
18–84Not supported
85+Supportedsince Aug 25, 2020
Current: 155Firefox Android
4–68Not supported
79+Supportedsince Jul 28, 2020
Current: 157Safari iOS
1–13.4Not supported
14+Supportedsince Sep 16, 2020
Current: 27How to use
This feature is Baseline widely available — use it freely, no fallback needed.
Example
JS
// Resolves with the first mirror that responds successfully
const fastest = await Promise.any([
fetch("https://mirror-a.example/data.json"),
fetch("https://mirror-b.example/data.json"),
]);Feature detection
JS · check before using
if ("any" in Promise || ("prototype" in Promise && "any" in Promise.prototype)) {
// Promise.any is available
}Documentation (MDN)
Specification
Sub-features
Support for each part of the feature (5). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| AggregateError | 85 | 85 | 79 | 14 | 85 | 79 | 14 |
| AggregateError.AggregateError | 85 | 85 | 79 | 14 | 85 | 79 | 14 |
| AggregateError.errors | 85 | 85 | 79 | 14 | 85 | 79 | 14 |
| AggregateError.serializable_object | 98 | 98 | 103 | 17 | 98 | 103 | 17 |
| Promise.any | 85 | 85 | 79 | 14 | 85 | 79 | 14 |