Duration
5 min
Access
Pro
Transcript
Available

The Promise.race() method accepts an array (or any other iterable) of promises as a parameter. It returns a Promise object that is fulfilled or rejected once the first input promise is fulfilled or rejected:

  • As soon as any input promise is fulfilled, the returned Promise object is fulfilled with that value.
  • As soon as any input promise is rejected, the returned Promise object is rejected with that reason.

Promise.race() can be used to race multiple promises against each other and find the first promise to settle.