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.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (1)

Collapse
 
digituar profile image
digituar

A very detailed explanation

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay