0 votes
in JavaScript by
What is promise.all in Javascript?

1 Answer

0 votes
by

Promise.all is a promise that takes an array of promises as an input (an iterable), and it gets resolved when all the promises get resolved or any one of them gets rejected. For example, the syntax of promise.all method is below,

Promise.all([Promise1, Promise2, Promise3]) .then(result) => {   console.log(result) }) .catch(error => console.log(`Error in promises ${error}`))

Note: Remember that the order of the promises(output the result) is maintained as per input order.

...