From the course: JavaScript: Async
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Preparing the all method for executing multiple promises - JavaScript Tutorial
From the course: JavaScript: Async
Preparing the all method for executing multiple promises
- [Instructor] In some cases, you need more than one promise to finish before moving onto code that works with the results. While you could write somewhat involved code to do this, promises include an all method that allows you to specify an array containing multiple promises and moving to any chained methods like then and catch only when all promises have finished. The promise.all method returns an array of results from the promises it was passed. For our Explore California page, we're currently including weather only for Los Angeles. But California is a big state. At the very least, we could be including weather for San Francisco as well and maybe even some tourist destinations known for their extreme weather like Yosemite National Park and Mount Whitney. So switching over to our code, we need to rewrite things a little bit to work with a raise, and then we need to actually create our code using promise.all. So our…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Understanding promises2m 46s
-
(Locked)
Building asynchronous code with promises3m 59s
-
(Locked)
Appending methods to resolved promises2m 38s
-
(Locked)
Using catch methods for rejected promises3m 52s
-
(Locked)
Using the finally method for executing handlers3m 32s
-
(Locked)
Preparing the all method for executing multiple promises2m 16s
-
(Locked)
Implementing the all method for executing multiple promises6m 39s
-
(Locked)
Making code backward-compatible with polyfill1m 29s
-
(Locked)
-
-
-