JavaScript Callbacks vs Promises vs Async/Await

preview_player
Показать описание
In this video i will explain the difference between using Callbacks, Promises and Async/Await in JavaScript. We will go through an example that shows how the same code can be written in 3 different ways.

Many people have a wrong understanding of this topic. JavaScript is always synchronous and single-threaded. It is only asynchronous in such a way that it can make for example Ajax Calls which run in the background and do not interrupt other parts of the code from executing. This mostly happens during server requests while waiting for data.

Describing JavaScript as asynchronous is perhaps misleading. It's more accurate to say that JavaScript is synchronous and single-threaded with various callback mechanisms. Single-threaded and Synchronous means one at a time i.e. one line of code is being executed at a time in order the code appears. JS has Callback functions whose purpose is to allow JS to behave asynchronously so further parts of JS can run while waiting for a JS function that has been executed (for example a GET call) to return a response, JS will continue to run until the browser has an answer at that point the event loop aka the(browser) will execute the JS code that calls the callback function.

This video should give you an overview of the main differences between JavaScript Callbacks vs Promises vs Async/Await.

Disclaimer:
All videos are for educational purposes and use them wisely. Any video might have inaccurate or outdated information. I give my best to research every topic thoroughly but please be aware that videos can contain mistakes.
Рекомендации по теме
Комментарии
Автор

I usually don't write comments but man this helped me so much! I'm completely new to this topic and I really struggeled to understand it. Thanks a lot and keep it up!

Aaron-umbj
Автор

thank you for this simple but very clear explanation of their comparison. after watching several videos about these 3, only your video is so clear to me. You are amazing.

christianrodriguez
Автор

Seems a good one, but the background music is too high, could hardly hear the explanation :(

rimansingla
Автор

Very well explained! The concepts are more clear to me now. Thank you very much!!

nishametri
Автор

Thank you! I am currently trying to learn how to write google chrome addons and therefore, I also need to use Javascript properly. This helped me a lot!

Thakko
Автор

Thank you for your brief explanation! Hopefully, you can make another great explainer video. Keep it up!

farisadlin
Автор

Thank you for the great video, it helped me a lot. I would just one suggestion for ;) I don't know how the others consider that but for me, it is a bit disturbing that background music. Maybe it is good to use that as an intro but then then mute that afterwards... but no big deal.

vaclavvlcek
Автор

Thanks! Nicely explained! short and to the point!

shreyavinchankar
Автор

Your voice and Background music, both sounds too good together, enjoying your video 😊😊👍

thecoderraj
Автор

Good explanation, but i wasn't able to concentrate with the background music.

nishanthsomu
Автор

Well explained
The background music was unnecessary though

subadra
Автор

great tutorial! well explained :) May I ask if you can share the script you used here? I’d like to play around. Thanks!

chensam
Автор

Could you have done without the .then() statements in the async await example? Will it not wait and then run the code below, event wihtout a .then()?

Qbabxtra
Автор

Can anyone pls solve my doubt whether can we use .then without importing any module/package ?

lifeistolive
Автор

next time try to come up with easy examples pal

ka_ka
Автор

An utterly useless explanation for beginners. Sorry. So many of your explanations and bits of code include things that aren't explained. Not recommended for beginners to this topic.

bobbysilver