Javascript Promises vs Async Await EXPLAINED (in 5 minutes)

  Рет қаралды 530,919

Roberts Dev Talk

Roberts Dev Talk

2 жыл бұрын

In this tutorial I explain what Javascript promises are, why we need them, and how to use them, catch errors properly and then convert the same code to use async and await. With examples!
☕️ Don't forget, old developers need coffee (and.. beer and pizza too 🍺 🍕)
www.buymeacoffee.com/Robertsd...
Check out the Bored API for fun sample data:
www.boredapi.com/
📧 📫 Join us on our developer journey! Sign up to our email newsletter:
robertsdevtalk.com
🐦 Follow us on Twitter:
/ robertsdevtalk
🎶 Music by Epidemic Sound:
www.epidemicsound.com/referra...
Our gear - click through to support our channel! :)
Camera (Canon M50)
🇬🇧 UK: amzn.to/3sUbzuL
🇺🇸 US: amzn.to/3uBsG5c
Camera mic (RODE VideoMic Pro)
🇬🇧 UK: amzn.to/3ml8xgC
🇺🇸 US: amzn.to/2RkGxyi
Camera tripod (Manfrotto Compact tripod):
🇬🇧 UK: amzn.to/3fJGyWU
🇺🇸 US: amzn.to/3mF4oV2
Voiceover Mic (Blue Yeti)
🇬🇧 UK: amzn.to/2PV7UOQ
🇺🇸 US: amzn.to/3uMiEym
Chris's dev mouse for PC (Logitech MX Master 3)
🇬🇧 UK: amzn.to/39K7BNV
🇺🇸 US: amzn.to/3uKYvso
Chris's dev keyboard for PC (Logitech MX Keys)
🇬🇧 UK: amzn.to/3rSbHcX
🇺🇸 US: amzn.to/3a6Unef
Rob's dev keyboard for Mac (Apple Magic Keyboard)
🇬🇧 UK: amzn.to/3dEQpKG
🇺🇸 US: amzn.to/3sb6JZc
Rob's dev mouse for Mac (Apple Magic Mouse)
🇬🇧 UK: amzn.to/3sRCQhr
🇺🇸 US: amzn.to/3mFi6qS
Icons in this video kindly provided by FlatIcon from Freepik
www.freepik.com
www.flaticon.com
JS icon provided by Icon8 icons8.com
Disclaimer - some of our links are affiliate links, which means that we receive a small commission for any sales made via those links, at no extra cost to you - so a great way to support our channel! Thank you so much for your support 😊
#javascript #promises #async

Пікірлер: 711
@atatdotdot
@atatdotdot 9 ай бұрын
2:25 "Then is called when the task completes... the catch method is called if anything goes wrong". This is wrong. These methods are called immediately. It's the functions that you pass to them that are called on those conditions. This may sound like pedantry but I would strongly suggest anyone trying to learn this to fully understand the distinction here.
@RDT
@RDT 9 ай бұрын
Good catch, thanks. Pinning this comment.
@paulhetherington3854
@paulhetherington3854 8 ай бұрын
Only if - there be - () call f(x) - pre amp d(x)! It never did - ught yet?
@jellyjollyjelly9513
@jellyjollyjelly9513 4 ай бұрын
"It's the functions that you pass to them that are called on those conditions. " what do you mean by "on those conditions"? do you mean the functions passed to then() and catch() are called after the task completes? im confused about this sentence
@mattpickel223
@mattpickel223 3 ай бұрын
@@jellyjollyjelly9513 I think he is saying the method 'then' is called immediately when that line is executed. It is a method of a Promise. It binds a callback function that will be called when the promise returns fulfilled. 'The 'then' method is called when the task completes' would be wrong and should be 'The callback function passed to the 'then' method will be called when the task completes'
@sergioadame5528
@sergioadame5528 3 ай бұрын
the .then anc .catch methdos being called inmediatly ever affects something? why giving the distinction between the execition of the methods en the code inside it if nothing will happen until the promise es fullfield? i guess there is something but cant thing of a case
@dub161
@dub161 2 жыл бұрын
this is what I call a perfect 10/10 explanation. "Crisp" and at the same time complete information with example.
@RDT
@RDT 2 жыл бұрын
Thanks for your kind words and support of the channel Nakshatra
@lecomar7220
@lecomar7220 Жыл бұрын
@@RDT The tutorial was beyond. It was quick BUT delivered ALL the information I was looking for. Thank you so much Roberts Dev Talk, wow!!!!!!!!😮😃😍
@omdodmani3205
@omdodmani3205 2 ай бұрын
Yeah! Example Makes it way easier to understand compared to just explaining the theory.
@SoraJustAGuy
@SoraJustAGuy Жыл бұрын
It’s important to point out that working with multiple apis you often have to chain multiple promises resulting in callbacks nested inside callbacks nested inside callbacks nested inside callbacks…you get the idea. 😅This is what we call a CALLBACK HELL. So the primary reason async/ await exists is to avoid a callback hell
@RDT
@RDT Жыл бұрын
Absolutely 👍🏻
@babykosh5415
@babykosh5415 Жыл бұрын
This is what I was looking for...thank you for asking this!
@Ketan2555
@Ketan2555 Жыл бұрын
@@kkdpsudpsu Promise.all is not suitable when you need to ensure the first API call's response is available before making another API call that relies on it.
@mohamedafrid1349
@mohamedafrid1349 11 ай бұрын
I just want to call another api using first call's result. What method I have to follow ?
@mohamedafrid1349
@mohamedafrid1349 11 ай бұрын
By the way, i am using subscription for the first call
@dom9534
@dom9534 2 жыл бұрын
dude this just made so many lightbulbs go off in my head and tied so many things together for me. thank you
@RDT
@RDT 2 жыл бұрын
Thanks! Glad to hear it helped - I hoped it would do 🙏
@joelmounts3336
@joelmounts3336 2 жыл бұрын
hugely underrated. so few channels are 1. this well edited AND 2. this well explained
@RDT
@RDT 2 жыл бұрын
Thank you that means a lot to hear 🙏
@vladpanchuk4699
@vladpanchuk4699 Жыл бұрын
agree
@nelsondasilva3935
@nelsondasilva3935 Жыл бұрын
perfect: short and sweet.. no fluff or dragged on and on examples.. 10/10
@hamzadlm6625
@hamzadlm6625 Жыл бұрын
The first person I watch to not explain 1 phrase using 20 phrases, neat and straight to the point! thank you.
@mattmcrae
@mattmcrae 5 ай бұрын
Umm... This is by far the most simple and logical explanation of this topic I've seen. In five minutes I've gone from writing code I didn't understand to totally getting it. Thank you!
@RDT
@RDT 5 ай бұрын
Excellent!
@wassimmouloud3432
@wassimmouloud3432 Жыл бұрын
the way you explain things is just perfect
@chrislione950
@chrislione950 Жыл бұрын
Wow,this is hands down the best explanation of this topic. Thanks alot
@mushroomthump
@mushroomthump Жыл бұрын
I was so confused about this, cleared it up for me, thanks!
@PerryCS2
@PerryCS2 11 ай бұрын
I really like how you add the code to the video AS you explain it... helps break things down...
@venkateshak.s9290
@venkateshak.s9290 Жыл бұрын
Very neat n crisp information without any extra buzz! 🤗👏
@onepointproduction9092
@onepointproduction9092 Жыл бұрын
Good lord, it's the most clear explanation i've ever watch. Thanks bro
@djrmarketing598
@djrmarketing598 Ай бұрын
This was a great explanation. Despite programming for 25+ years, I've used Promises a ton in JS and C# I've used promises there too and never really understood that await/async was basically the same thing just sequential. 5 stars on your explanation!
@RDT
@RDT Ай бұрын
Thanks
@vegeta4614
@vegeta4614 2 жыл бұрын
This is really helpful. Will go through all ur javascript turorials now
@MichaelKim505
@MichaelKim505 2 ай бұрын
Truely helpful and insightful explanation on Promise with good examples.
@huangtiantian8770
@huangtiantian8770 Жыл бұрын
Thanks! This is the best video explaining await and promises I have ever seen
@francodominguez238
@francodominguez238 2 ай бұрын
This is the most beautiful explanation I've ever heard, thank you
@RDT
@RDT 2 ай бұрын
Thank you! 🤩
@eidercarlos6391
@eidercarlos6391 Жыл бұрын
Great! The best explanation about the topic I've seen! Thanks!
@tanjimulislamsabbir857
@tanjimulislamsabbir857 3 ай бұрын
This is very clear and organised video. I loved it.❤
@kunikaingale4704
@kunikaingale4704 Жыл бұрын
bruh why so underrated?! Such a marvellous explanation, straight to the point
@GovindYaswanth
@GovindYaswanth 10 ай бұрын
Had listened to lot of videos and read articles. But Wow!!! Yours is best explained and perfect real time example... Love it Man!!!
@richk5015
@richk5015 2 ай бұрын
Thank you, Chris, for explaining everything so eloquently. 🙏
@RDT
@RDT Ай бұрын
My pleasure!
@AbhishekTiwari-xt1kt
@AbhishekTiwari-xt1kt Жыл бұрын
Wow, nicely explained, short and sweet No BS
@joepage3065
@joepage3065 Жыл бұрын
Very clear and concise explanation. Thanks 👍
@danglad5546
@danglad5546 Жыл бұрын
Great simple explanation, you are very good at it.
@InderjeetSingh-zm3sf
@InderjeetSingh-zm3sf 11 ай бұрын
Loved the explanation....it helped alot thanks!!!!
@mikehillbilly4079
@mikehillbilly4079 Ай бұрын
Concise, precise and nice. Excellent!
@RDT
@RDT 7 күн бұрын
Thanks
@Aziz-kw6ct
@Aziz-kw6ct 2 ай бұрын
Your explanation was perfect, thank you for the effort.
@RDT
@RDT 2 ай бұрын
Glad it was helpful!
@ChaDaeyeob
@ChaDaeyeob 9 ай бұрын
After struggling with various definitions of async/await, I stumbled upon this video which made everything crystal clear. Thank you so much Mr. Sir Roberts for simplifying things!
@RDT
@RDT 9 ай бұрын
You're very welcome!
@sadhappy8860
@sadhappy8860 7 ай бұрын
I find that alot of 'programming words' are quite strange. It may sound complicated but it just needs someone to use the right explanation and then it clicks. A very helpful video, much appreciated.
@bennythetiger6052
@bennythetiger6052 Жыл бұрын
Oh my God!!! This explanation is perfect! I was really struggling to understand both promises and async functions, but now I see it all! Thank you so much!
@chrisstrauss7288
@chrisstrauss7288 10 ай бұрын
Best explanation iv seen on this to date. Cleared up a lot for me
@svalyavasvalyava9867
@svalyavasvalyava9867 3 ай бұрын
Thank you infinitely for the clear explanation 😊
@OlgaDayneko
@OlgaDayneko 2 жыл бұрын
Very good explanation! Thank you!
@DamianDemasi
@DamianDemasi Жыл бұрын
Great explanation! Thanks for the video :)
@jenkov2155
@jenkov2155 5 ай бұрын
Been a bit confused about the promises, async await, and try catch thing. But not anymore. Best explanation :D
@JasperEjoc
@JasperEjoc Жыл бұрын
of all the videos I watched, this is by far the most simple explanation of promises then, catch vs async await, thank you for this video
@RDT
@RDT Жыл бұрын
You're very welcome!
@kashix.
@kashix. Жыл бұрын
This is the best explanation with the best examples I've ever seen about async in Javascript. Thank you very much!!
@RDT
@RDT Жыл бұрын
You're very welcome!
@tassneemaltaf2001
@tassneemaltaf2001 Жыл бұрын
Loved the explanation
@user-jb3dz6pp1o
@user-jb3dz6pp1o 3 ай бұрын
This explanation was amazing. It was not complicated at all. Thank you.
@RDT
@RDT 3 ай бұрын
You're very welcome!
@mehmetbulut1553
@mehmetbulut1553 Жыл бұрын
After months of struggle finally understanding Promises thank you so much Robert. Definitely subscribed 🥰
@RDT
@RDT Жыл бұрын
Thanks for the sub Mehmet! Glad the video helped you 🙏
@gravitasfolly8615
@gravitasfolly8615 9 ай бұрын
Excellent tutorial. Made it so simple
@josecarlosgarcia6477
@josecarlosgarcia6477 Жыл бұрын
this is the best explanation on KZfaq, Thanks
@roebienarnaiz
@roebienarnaiz Жыл бұрын
Concise! Great explanation.
@idanhen10
@idanhen10 11 ай бұрын
Amazingly explained!
@mohitgoyal9931
@mohitgoyal9931 2 ай бұрын
Great explanation 😊
@samichosen524
@samichosen524 Жыл бұрын
Amazing presentation and great explanation, thanku
@comrade_rahul_1
@comrade_rahul_1 Ай бұрын
This was the first I understood async, await! Amazing video. 🤗
@RDT
@RDT Ай бұрын
Awesome! Thank you!
@FailNTry
@FailNTry 7 ай бұрын
One of the best video i watched in 5 mins well done ❤
@backtic_education
@backtic_education Жыл бұрын
Verrrrrrrrrrrrrry good explanation. Thank you so much.
@d0m2288
@d0m2288 2 ай бұрын
Great explanation, thank you.
@Nneoh1
@Nneoh1 Жыл бұрын
Phenomenal explanation, thank you!
@returnMarcco
@returnMarcco 11 ай бұрын
Thanks for the video Rob
@jacintdavid5333
@jacintdavid5333 2 жыл бұрын
Watched async videos of bigger channels first and I have to say yours was superb!
@RDT
@RDT 2 жыл бұрын
Thanks, that means a lot to hear 🙏
@jakub2631
@jakub2631 Жыл бұрын
Great explanation, thank you!
@DnKZone
@DnKZone Жыл бұрын
thanks it's really clear to me what promise in js is
@Jeremiahking101
@Jeremiahking101 Жыл бұрын
This literally made my day! THANK YOU!
@tamimabdullah3624
@tamimabdullah3624 3 ай бұрын
the explanation was really helpful!
@sekki2554
@sekki2554 6 ай бұрын
Very well explained!
@KerishaStewart
@KerishaStewart Жыл бұрын
good refresher! thanks much!
@awaraamin6850
@awaraamin6850 Жыл бұрын
Great job! it demystified the whole idea!
@zhaofour9833
@zhaofour9833 8 ай бұрын
The best explanation so far only uses 5 min and easy but illustrative example
@SonnyTechAcademy
@SonnyTechAcademy Жыл бұрын
Great video man!
@raziqijr
@raziqijr Жыл бұрын
this was one of the best explanation of async and promises !
@akulaganeshsantosh4584
@akulaganeshsantosh4584 Ай бұрын
crisp clear straight to the point no bullshit awesome tutorial
@RDT
@RDT Ай бұрын
Thanks pal
@neetujoshi6005
@neetujoshi6005 11 ай бұрын
Subscribed...short/simple easy to understand.
@keyvanhosseini3518
@keyvanhosseini3518 Жыл бұрын
This video was so useful, thank you for creating it. 🙂🙂
@somtoilo7465
@somtoilo7465 8 ай бұрын
This is perfect! Wow best explanation I've come across
@RDT
@RDT 8 ай бұрын
Wow, thanks!
@leonardmbibi8013
@leonardmbibi8013 7 ай бұрын
Well summarized, thanks
@oguzhanaydn7482
@oguzhanaydn7482 Жыл бұрын
very good and instructive video, i get it better now thank you
@drakZes
@drakZes Жыл бұрын
Best Promise explanation I have ever seen in my life!!!
@RDT
@RDT Жыл бұрын
Wow, thank you! 🙏
@kadidibwa968
@kadidibwa968 Жыл бұрын
Clean and precise explanation
@TriNguyenuc-jc3fp
@TriNguyenuc-jc3fp 3 ай бұрын
Phenomenal explanation! You make my day sir
@RDT
@RDT 3 ай бұрын
Glad you liked it! Thanks
@lautarozambella1887
@lautarozambella1887 2 ай бұрын
Great explanation, thanks!
@RDT
@RDT Ай бұрын
Glad it was helpful!
@elisamunozespineira6809
@elisamunozespineira6809 Жыл бұрын
super well explained, I have watched tons of videos and I finally feel like I understand it!
@RDT
@RDT Жыл бұрын
Thanks Elisa, glad it was helpful to you 🙏
@anshvashisht8519
@anshvashisht8519 Жыл бұрын
great explanation i have been struggling on google but you made it so easy.
@RDT
@RDT Жыл бұрын
Glad it helped you Ansh, I tried to make the video I was looking for when I was trying to understand it!
@normanluismadrid422
@normanluismadrid422 Жыл бұрын
beautifully explained, thanks for this
@KieranMueller
@KieranMueller Жыл бұрын
Awesome explanation
@supernova82
@supernova82 2 жыл бұрын
This is great. Well done!
@Noraia
@Noraia Жыл бұрын
Best video about promises I watched so far!
@amityadav-np1rk
@amityadav-np1rk Жыл бұрын
Very well explained!! Thank you 🙏
@fr3dlopez
@fr3dlopez Жыл бұрын
Absolutely wonderful material!
@RDT
@RDT Жыл бұрын
Thank you!
@someguynamedvictor
@someguynamedvictor 9 ай бұрын
Beat explanation of these two concepts I’ve ever heard. 👍
@RDT
@RDT 8 ай бұрын
That’s really kind, thank you
@Eddie4k
@Eddie4k Жыл бұрын
Great informative video!
@philipackerley5775
@philipackerley5775 Жыл бұрын
Superbly put together Chris, never heard or seen it explained as well 😇
@RDT
@RDT Жыл бұрын
Wow, thank you 🙏😊
@returnMarcco
@returnMarcco 11 ай бұрын
It's Rob
@user-nd7sk2ph4f
@user-nd7sk2ph4f Жыл бұрын
Thanks a lot for this great tutorial🎉
@VOGTLANDOUTDOORS
@VOGTLANDOUTDOORS Жыл бұрын
A VERY CLEAR handling of this often-confusing topic. You just EARNED another subscriber ! -Mark in North Aurora IL (USA)
@RDT
@RDT Жыл бұрын
Thanks for your support Mark 🙂
@wildpett
@wildpett 4 күн бұрын
Great video :) Thx for sharing
@sanampakuwal
@sanampakuwal 2 жыл бұрын
Really smooth, subscribed!
@RDT
@RDT 2 жыл бұрын
Thanks Sanam
@prasadkadu9737
@prasadkadu9737 Жыл бұрын
The editing is top class
@alisonoz7219
@alisonoz7219 Жыл бұрын
excellent explanation!! thank you so much!!
@DipanjanPatra
@DipanjanPatra Жыл бұрын
Cleanest async/await explainer!
@nadeeshapiushan8468
@nadeeshapiushan8468 2 ай бұрын
This really helped. Thanks!
@zaeemjaved6850
@zaeemjaved6850 Жыл бұрын
BEST VIDEO ON THIS TOPIC! PERIOD!
@Reaper_f30
@Reaper_f30 Жыл бұрын
coffee example is one of the best clearest ones ive seen man :D
@RDT
@RDT Жыл бұрын
Thanks glad you liked it mate 🙂
@thishandharmakeerthi5327
@thishandharmakeerthi5327 Жыл бұрын
Hands down, Quality content 10/10. I subscribed the channel.
@nerdy561
@nerdy561 Жыл бұрын
Best explanation video out there!
@natasdabsi1138
@natasdabsi1138 3 ай бұрын
very well explained !
Tips For Using Async/Await in JavaScript
16:26
James Q Quick
Рет қаралды 394 М.
What are JavaScript PROMISES? 🤞
12:37
Bro Code
Рет қаралды 33 М.
ХОТЯ БЫ КИНОДА 2 - официальный фильм
1:35:34
ХОТЯ БЫ В КИНО
Рет қаралды 1,5 МЛН
OMG 😨 Era o tênis dela 🤬
00:19
Polar em português
Рет қаралды 3,6 МЛН
Promise in javascript | chai aur #javascript
50:21
Chai aur Code
Рет қаралды 180 М.
Node.js Ultimate Beginner’s Guide in 7 Easy Steps
16:20
Fireship
Рет қаралды 1,5 МЛН
JavaScript Pro Tips - Code This, NOT That
12:37
Fireship
Рет қаралды 2,5 МЛН
The Async Await Episode I Promised
12:04
Fireship
Рет қаралды 1,1 МЛН
Async Await vs. Promises - JavaScript Tutorial for beginners
24:30
Async JS Crash Course - Callbacks, Promises, Async Await
24:31
Traversy Media
Рет қаралды 1,4 МЛН
ХОТЯ БЫ КИНОДА 2 - официальный фильм
1:35:34
ХОТЯ БЫ В КИНО
Рет қаралды 1,5 МЛН