Standard built-ins
Promise.any()
Fulfills with the first successful input. If every input rejects, rejects with AggregateError containing rejection reasons in input order. Empty input rejects.
Formal Syntax & Structure
javascript syntaxjavascript
Promise.any(iterable)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| iterable | Iterable | Values or promises. |
Return Value
Promise
First fulfillment or aggregate rejection.
Working Example
Example Snippetjavascript
Promise.any([Promise.reject("bad"),Promise.resolve("ok")]).then(console.log);