This question is asked in many JavaScript, Node, Angular, React.. interviews

Why use Promise.all ?

Promise.all is actually a promise that takes an array of promises as an input (an iterable). Then it gets resolved when all the promises get resolved or any one of them gets rejected.

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

What is Polyfill

A polyfill is a piece of code (usually JavaScript on the Web) used to provide modern functionality on older browsers that do not natively support it.

Suppose Promise.all not available so lets create our Promise.all() function . we will use async and await to achieve this.

Promise.all Polyfill



Shivam Gupta

Shivam Gupta


Full Stack Engineer (Web/App) working on different JS Technologies & frameworks— Angular, Node, Typescript, Ionic, Firebase, AWS, ElK...Love to write cool stuff