Standard built-ins

Promise.race()

Try the free JavaScript compiler

Adopts the first settlement of an input. A rejection may win. Empty input leaves the returned promise pending.

Formal Syntax & Structure

javascript syntaxjavascript
Promise.race(iterable)

Parameters & Attributes

NameTypeDescription
iterableIterableValues or promises.

Return Value

Promise

Adopts the first settlement.

Working Example

Example Snippetjavascript
Promise.race([Promise.resolve("A"),Promise.resolve("B")]).then(console.log);
JavaScript Reference