Standard built-ins
Promise.all()
Fulfills with all fulfillment values in iteration order or rejects when a constituent rejects. Does not cancel other operations.
Formal Syntax & Structure
javascript syntaxjavascript
Promise.all(iterable)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| iterable | Iterable | Values or promises. |
Return Value
Promise<Array>
Aggregate of all successful values.
Working Example
Example Snippetjavascript
let finish; const first = new Promise(r => { finish = r; });const second = Promise.resolve("B");Promise.all([first, second]).then(v => console.log(v.join(",")));finish("A");