JavaScript Promise.any() Method
The Promise.any() static method resolves with the first promise that succeeds, ignoring failures unless every promise fails.
Description
The Promise.any() static method returns a promise that fulfills as soon as any one of the input promises fulfills, with its value. Rejections are ignored unless all the promises reject, in which case it rejects with an AggregateError listing every reason. It suits trying several sources, such as mirrors, and taking whichever responds first.
If you pass an empty array, the promise rejects immediately with an AggregateError, since nothing can succeed. The other promises keep running after one fulfills; JavaScript has no built-in way to cancel them, but fetch() requests can be stopped with an AbortController once a winner is found.
Compare it with Promise.race(), which settles with the first promise to finish, even if that's a failure, and Promise.all(), which needs every promise to succeed.
Syntax
Promise.any(iterable)Parameters
- iterableAn iterable of promises or values.
Return Value
A promise that fulfills with the first fulfilled value, or rejects with an AggregateError if they all reject.
Example
Browser Support
The following information will show you the current browser support for the Promise.any() method. Hover over a browser icon to see the version that first introduced support for this method.
Desktop





Tablets & Mobile





