DEV Community

Play Button Pause Button
James Bubb
James Bubb

Posted on

JavaScript Promises Explained in 10 Minutes

Originally published here on YouTube.
(Please give me a thumbs up and subscribe if you found this useful 🙏).

Check out some of the other Junior Developer Central videos in this series

— Follow Me —
— Thanks! —

So this JavaScript tutorial will take you through the basics of what JavaScript Promises are and give you some example of how to use them in your code.

There are a few similarities with the callback vs Promise JavaScript approaches and at the start of the video we'll take a look at the differences between callbacks and Promises and see how Promises provide you with a nice interface for handling asynchronous code.

So we'll take a look at the JavaScript callback vs Promise approach and then we'll move on to creating JavaScript Promises and see how you can use the provided resolve and reject functions that are passed in to a new JavaScript Promise to provide either a success of failure approach depending on the result of a particular operation.

You'll see in the video how JavaScript Promises handle asynchronous code gracefully and we'll also take a some of the other built in function available to work with multiple promises in JavaScript.

Finally, we'll take a look at the fetch API to examine how it uses JavaScript Promises and explain how each function actually returns a Promise and how these Promises can be chained together.

Top comments (1)

digituar profile image

A very detailed explanation