JavaScript Promise.all() Method
The Promise.all() static method waits for several promises to finish and gives back all their results in an array. If any one rejects, the whole thing rejects.
Description
The Promise.all() static method takes several promises and returns a single promise that fulfills when all of them have fulfilled, with an array of their results in the same order as the input. It's the standard way to run independent asynchronous tasks in parallel, such as several fetch() requests.
If any promise rejects, the returned promise rejects straight away with that reason, and the other results are lost (though the other tasks keep running). When you want every result regardless of failures, use Promise.allSettled().
An empty array resolves immediately with an empty array, and values that aren't promises are passed through as they are. A common pattern combines it with map(): await Promise.all(ids.map(id => load(id))). If you have hundreds of tasks, starting them all at once can overwhelm a server, so process them in smaller batches instead.
Syntax
Promise.all(iterable)Parameters
- iterableAn iterable, such as an array, of promises or values.
Return Value
A promise that fulfills with an array of all the results, in order, or rejects with the first rejection reason.
Example
Browser Support
The following information will show you the current browser support for the Promise.all() method. Hover over a browser icon to see the version that first introduced support for this method.
Desktop





Tablets & Mobile





