The Promise.race() Method

Learn how the Promise.race() method returns an appropriate response as soon as any promise settles.

While Promise.any() short-circuits after the first fulfilled promise, we may also want to short-circuit the operation based on the first settled promise, regardless of the outcome. In that case, we can use Promise.race().

Returning the fastest settling promise as soon as it settles

The Promise.race() method provides a slightly different take on monitoring multiple promises. This method also accepts an iterable of promises to monitor and returns a promise, but the returned promise is settled as soon as the first promise is settled.

Get hands-on with 1400+ tech skills courses.