Standard built-ins
Promise.allSettled()
Collects fulfillment and rejection records in input order after all inputs settle. Errors in obtaining or consuming the iterable can reject the aggregate.
Formal Syntax & Structure
javascript syntaxjavascript
Promise.allSettled(iterable)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| iterable | Iterable | Values or promises. |
Return Value
Promise<Array>
Array of status/value or status/reason records.
Working Example
Example Snippetjavascript
Promise.allSettled([Promise.resolve(4), Promise.reject("missing")]).then(results => console.log(JSON.stringify(results)));