Favorites

JavaScript Promise.any() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Promise.any()
JavaScript Promise Static methodThis method is supported by all modern browsers.
Updated 28th November 2026

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

const delay = (ms, v, fail) => new Promise((res, rej) => setTimeout(() => (fail ? rej(new Error(v)) : res(v)), ms));

Promise.any([delay(100, 'A', true), delay(200, 'B'), delay(300, 'C')])
  .then(v => console.log('First success:', v));

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.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee