Search⌘ K
AI Features

The Promise.race() Method

Explore the Promise.race() method to understand how it settles as soon as the first promise in an iterable resolves or rejects. Learn how to manage multiple promises by returning the fastest result, regardless of success or failure, enhancing your control over asynchronous JavaScript operations.

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 ...