Promise.all()
noun
say it: “PROM-is AWL” /ˈprɑmɪs ɔl/
A method that waits for a list of promises together and gives back all their values in order, or fails as soon as any one of them fails.
What does Promise.all() do in JavaScript?
Promise.all() — A method returning a Promise that fulfills when every input fulfills or rejects when one rejects.
const results = await Promise.all([loadUser(), loadOrders()]);
In a sentence
- “Promise.all() baked the three pizzas at the same time, so the order took as long as the slowest one, not all three added up.”
- “When one of the toppings failed to load, Promise.all() rejected and the page showed an error.”
Level: Freelancer · More JavaScript terms at this level
Updated