wiki/content/20201111094957-executing_promises_in_parallel_promises_all.md

26 lines
441 B
Markdown
Raw Normal View History

2024-05-06 20:40:05 +00:00
---
2024-10-30 17:04:36 +00:00
date: 20201111
2024-05-06 20:40:05 +00:00
id: fe95210e-f59a-45a4-b0ed-f4d3ec981a07
title: Executing Promises in Parallel (Promises.all)
---
# Description
Run promises in parallel. Will throw an
[exception](20201111092905-javascript_exceptions) if one of the requests
fail.
# Syntax
``` javascript
Promise.all([
asyncFunc1(),
asyncFunc2(),
])
.then(([result1, result2]) => {
})
.catch(err => {
// Receives first rejection among the Promises
});
```