Standard built-ins

Promise.allSettled()

Try the free JavaScript compiler

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

NameTypeDescription
iterableIterableValues 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)));
JavaScript Reference