Introduction to JavaScript Promises in Depth

Marius Schulz
InstructorMarius Schulz
Share this video with your friends

Social Share Links

Send Tweet

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.