DEV Community

0 seconds of 10 minutes, 39 secondsVolume 90%
Press shift question mark to access a list of keyboard shortcuts
00:00
00:00
10:39
 
James Bubb
James Bubb

Posted on

5 2

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 —
Twitter: https://www.twitter.com/codebubb
Facebook: https://www.facebook.com/juniordevelopercentral/
Blog: https://www.juniordevelopercentral.com/
— 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.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (1)

Collapse
 
digituar profile image
digituar

A very detailed explanation

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Retry later