Learn about Promise.all() and how to aggregate multiple asynchronous promises into a single operation.
- [Narrator] Promises help clean up…the callback pattern tremendously,…but there's another pattern…that might have caused you angst in the past.…What if you had several callbacks…that needed to happen in parallel…and complete before continuing, like this example.…This could happen if you need to make a few HTTP calls…before rendering a page,…or writing several records to different database tables…before sending a response.…Whatever the case, the ES6 promise object…provides a solution in the Promise.all() function.…
Promise.all() takes a collection of promises…and then resolves once all have been completed…or any of them errors.…Basically, the Promise.all() call…is returning a single promise,…so you can use the same .then() and .catch() functions…from the promise API.…The arguments pass to resolve…and each promise from the collection…is passed as an array to the final promise.then() function.…The order of the elements in the results array…that is passed to the .then() function…is the same as the order of the promises…
- Using arrow functions
- Using default parameters
- Reviewing the class structure in ES6
- Assigning variables with let and const
- Array destructuring and object destructuring
- Replacing callbacks with promises
- Keeping values unique with Set
- Dropping the prototype with Map
- Working with generators
- Using yield with arguments
Skill Level Intermediate
Building a Website with Node.js and Express.jswith Ray Villalobos3h 16m Intermediate
Node.js: Test-Driven Developmentwith Alexander Zanfir33m 17s Intermediate
Learning NPM the Node Package Managerwith Ray Villalobos35m 14s Intermediate
Building a Web Interface with React.jswith Ray Villalobos1h 21m Intermediate
3. Promises and Collections
4. Iterators and Generators
Next steps1m 41s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.