1.

Explain classes in ES6?

Answer»

The Promise.all  method returns a single Promise that resolves when all of the promises in the iterable argument have resolved or when the iterable argument contains no promises. It rejects with the reason of the first promise that rejects.

Let’s refactor the ASYNC await code from PREVIOUS question to use Promise.all. NOTICE, that we are also using array destructuring at line 6, to RECEIVE all the values returned by the promise.

 We should use Promise.all in only cases like above, where the result of ONE Promise is not dependent on other promise.



Discussion

No Comment Found