Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save FrancoStino/96604adbbe2599bcf7cf4f04b7b02d8b to your computer and use it in GitHub Desktop.
Save FrancoStino/96604adbbe2599bcf7cf4f04b7b02d8b to your computer and use it in GitHub Desktop.
Takes an array of promises as an input and gets resolved when all the promises get resolved or any of them gets rejected. From The Pieces JavaScript Collection.

Aggregating results from multiple promises

Preview:
Promise.all([ promise_1, promise_2 ]).then((values) => {
    // all input Promises resolved
}).catch((reason) => {
    // one of input Promises rejected
});
Associated Context
Type Code Snippet ( .js )
Associated Tags promise pieces javascript collection es6-promise javascript
📝 Custom Description Takes an array of promises as an input and gets resolved when all the promises get resolved or any of them gets rejected. From The Pieces JavaScript Collection.
Related Links https://www.freecodecamp.org/news/promise-all-in-javascript-with-example-6c8c5aea3e32/
https://code.pieces.app/collections/javascript
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all
https://www.javascripttutorial.net/es6/javascript-promise-all/
Related People Pieces Team, Davide Ladisa
Sensitive Information No Sensitive Information Detected
Shareable Link https://davideladisa.pieces.cloud/?p=2d24499f4b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment