From the course: JavaScript: Async
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Implementing the all method for executing multiple promises - JavaScript Tutorial
From the course: JavaScript: Async
Implementing the all method for executing multiple promises
- [Instructor] And so now, moving down to the code that runs when the page is loaded, right now, I have my get, then, catch and finally statements. And I, down here in my finally statement, I'm creating this element called weather div that just creates a reference to a dom element. But I'm going to need to use that in other parts of my code. So, I'm going to cut that and I'm going to move it up here right after my API key, so that's available all throughout my event listener here. And then the next thing I'm going to do is create a variable containing the coded names of the locations that I want to get weather for. So, I'm going to make that a constant, I'm going to call it locations. It's going to be an array. I'm going to break that onto multiple lines for legibility. So I'm going to do Las plus Angeles comma US. So this is the encoding that open weather map expects, and then we'll do San plus Francisco comma US. We'll…
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)
-
-
-