JS Coding Questions Logo
JS Coding Questions
#65💼 Interview💻 Code

What is promise.all

Advertisement

728x90

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,

javascript
1Promise.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.

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 66

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
65of476