Promise.race()

A function that returns a promise that settles as soon as the first of several promises settles.

In more detail

The returned promise follows whichever input settles first, fulfilled or rejected. It was the traditional way to add timeouts, but it does not cancel the losing work; AbortSignal.timeout() and AbortSignal.any() do.

Related terms

Taught in

References