Standard built-ins
Promise.race()
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
| Name | Type | Description |
|---|---|---|
| iterable | Iterable | Values or promises. |
Return Value
Promise
Adopts the first settlement.
Working Example
Example Snippetjavascript
Promise.race([Promise.resolve("A"),Promise.resolve("B")]).then(console.log);