Introduction to JavaScript Promises in Depth

Marius Schulz
InstructorMarius Schulz

Share this video with your friends

Send Tweet
Published 4 years ago
Updated 2 years ago

Here’s an overview of all the topics we’re going to cover. Enjoy the course!

Instructor: [00:00] In this course, we're going to do a deep-dive on promises in JavaScript. Ever since they've been added to the language, promises have been an increasingly important building block for asynchronous operations.

[00:11] We're going to start off by looking at the different states that a promise can be in. We'll then put together our first promise chain using the then method. Next, we're going to look at how to catch errors in a promise chain.

[00:24] Throughout this course, we're going to focus a lot on error handling, as many asynchronous operations fail all the time. We're also going to learn how to use the finally method to run cleanup code in a promise chain no matter if there was an error or not.

[00:39] Next up, we're going to look at how to create a rejected promise using the Promise.reject method. We're then going to see how we can use the Promise.resolve method to convert any promise-like object to a proper native promise.

[00:53] Alternatively, we can create a new promise from scratch using the promise constructor. We're also going to explore Node.js' util.promisify helper, which lets us convert a callback-based function to one that uses promises.

[01:07] Towards the end of the course, we're going to learn how to work with multiple promises. We can call the Promise.race method to wait for the fastest promise to settle. Similarly, we can call the Promise.all method to wait for all promises to settle.

[01:23] Finally, we're going to learn how to use async functions and the await operator to write asynchronous code that is almost as easy to read as synchronous code. Thanks for watching and enjoy the course.

Carlos Koulatsis
Carlos Koulatsis
~ 2 years ago

The course is great. The thing is that the API Calls on throws errors (This deployment is no longer available--zeit now 1.0). That makes the course hard to follow (unless you rely solely on the video. An update would be great.

Marius Schulz
Marius Schulzinstructor
~ 2 years ago

@Carlos, thanks for flagging! The API should be back up and running by now. Do let me know if you're still having trouble with it.