Javascript Promises vs Async Await EXPLAINED (in 5 minutes)

  Рет қаралды 523,718

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

Пікірлер: 707
@atatdotdot
@atatdotdot 8 ай бұрын
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 8 ай бұрын
Good catch, thanks. Pinning this comment.
@paulhetherington3854
@paulhetherington3854 7 ай бұрын
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 Жыл бұрын
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.
@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
@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 🙏
@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!
@hamzadlm6625
@hamzadlm6625 Жыл бұрын
The first person I watch to not explain 1 phrase using 20 phrases, neat and straight to the point! thank you.
@nelsondasilva3935
@nelsondasilva3935 Жыл бұрын
perfect: short and sweet.. no fluff or dragged on and on examples.. 10/10
@onepointproduction9092
@onepointproduction9092 Жыл бұрын
Good lord, it's the most clear explanation i've ever watch. Thanks bro
@chrislione950
@chrislione950 Жыл бұрын
Wow,this is hands down the best explanation of this topic. Thanks alot
@sadhappy8860
@sadhappy8860 6 ай бұрын
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.
@ChaDaeyeob
@ChaDaeyeob 8 ай бұрын
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 8 ай бұрын
You're very welcome!
@kunikaingale4704
@kunikaingale4704 Жыл бұрын
bruh why so underrated?! Such a marvellous explanation, straight to the point
@wassimmouloud3432
@wassimmouloud3432 Жыл бұрын
the way you explain things is just perfect
@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 🙏
@mushroomthump
@mushroomthump Жыл бұрын
I was so confused about this, cleared it up for me, thanks!
@venkateshak.s9290
@venkateshak.s9290 Жыл бұрын
Very neat n crisp information without any extra buzz! 🤗👏
@vegeta4614
@vegeta4614 2 жыл бұрын
This is really helpful. Will go through all ur javascript turorials now
@eidercarlos6391
@eidercarlos6391 Жыл бұрын
Great! The best explanation about the topic I've seen! Thanks!
@mikehillbilly4079
@mikehillbilly4079 19 күн бұрын
Concise, precise and nice. Excellent!
@PerryCS2
@PerryCS2 11 ай бұрын
I really like how you add the code to the video AS you explain it... helps break things down...
@InderjeetSingh-zm3sf
@InderjeetSingh-zm3sf 11 ай бұрын
Loved the explanation....it helped alot thanks!!!!
@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 🙏
@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!
@huangtiantian8770
@huangtiantian8770 Жыл бұрын
Thanks! This is the best video explaining await and promises I have ever seen
@GovindYaswanth
@GovindYaswanth 9 ай бұрын
Had listened to lot of videos and read articles. But Wow!!! Yours is best explained and perfect real time example... Love it Man!!!
@wheatley-digital
@wheatley-digital 5 ай бұрын
Really great video. Been stuck on this topic but makes total sense now!
@AbhishekTiwari-xt1kt
@AbhishekTiwari-xt1kt Жыл бұрын
Wow, nicely explained, short and sweet No BS
@joepage3065
@joepage3065 Жыл бұрын
Very clear and concise explanation. Thanks 👍
@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!
@chrisstrauss7288
@chrisstrauss7288 9 ай бұрын
Best explanation iv seen on this to date. Cleared up a lot for me
@Nneoh1
@Nneoh1 Жыл бұрын
Phenomenal explanation, thank you!
@user-yy4pd2vu2v
@user-yy4pd2vu2v 11 ай бұрын
Great explanation. Thank you!!
@Jeremiahking101
@Jeremiahking101 Жыл бұрын
This literally made my day! THANK YOU!
@djrmarketing598
@djrmarketing598 25 күн бұрын
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 21 күн бұрын
Thanks
@user-nd7sk2ph4f
@user-nd7sk2ph4f Жыл бұрын
Thanks a lot for this great tutorial🎉
@jalalkhan3166
@jalalkhan3166 Ай бұрын
Promises & async await ARE PROUD OF YOU. such explanation💛
@RDT
@RDT Ай бұрын
Thanks 🙏
@normanluismadrid422
@normanluismadrid422 Жыл бұрын
beautifully explained, thanks for this
@svalyavasvalyava9867
@svalyavasvalyava9867 2 ай бұрын
Thank you infinitely for the clear explanation 😊
@keyvanhosseini3518
@keyvanhosseini3518 Жыл бұрын
This video was so useful, thank you for creating it. 🙂🙂
@MichaelKim505
@MichaelKim505 2 ай бұрын
Truely helpful and insightful explanation on Promise with good examples.
@tassneemaltaf2001
@tassneemaltaf2001 Жыл бұрын
Loved the explanation
@samichosen524
@samichosen524 Жыл бұрын
Amazing presentation and great explanation, thanku
@tanjimulislamsabbir857
@tanjimulislamsabbir857 2 ай бұрын
This is very clear and organised video. I loved it.❤
@wtf_jokes9639
@wtf_jokes9639 10 ай бұрын
What an absolute break down. I wish all teachers had the touch to teach like you
@XX-vu5jo
@XX-vu5jo 6 ай бұрын
LOL he taught it the wrong way LOL!!!!!!!!!! you are clearly learning from wrong content, poor guy
@richk5015
@richk5015 Ай бұрын
Thank you, Chris, for explaining everything so eloquently. 🙏
@RDT
@RDT Ай бұрын
My pleasure!
@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!
@danglad5546
@danglad5546 Жыл бұрын
Great simple explanation, you are very good at it.
@returnMarcco
@returnMarcco 10 ай бұрын
Thanks for the video Rob
@jakub2631
@jakub2631 Жыл бұрын
Great explanation, thank you!
@awaraamin6850
@awaraamin6850 Жыл бұрын
Great job! it demystified the whole idea!
@philipackerley5775
@philipackerley5775 Жыл бұрын
Superbly put together Chris, never heard or seen it explained as well 😇
@RDT
@RDT Жыл бұрын
Wow, thank you 🙏😊
@returnMarcco
@returnMarcco 10 ай бұрын
It's Rob
@baderelhayah7961
@baderelhayah7961 Жыл бұрын
Thanks for the video, this is very helpful
@josecarlosgarcia6477
@josecarlosgarcia6477 Жыл бұрын
this is the best explanation on KZbin, Thanks
@DamianDemasi
@DamianDemasi Жыл бұрын
Great explanation! Thanks for the video :)
@Aziz-kw6ct
@Aziz-kw6ct 2 ай бұрын
Your explanation was perfect, thank you for the effort.
@RDT
@RDT Ай бұрын
Glad it was helpful!
@gravitasfolly8615
@gravitasfolly8615 9 ай бұрын
Excellent tutorial. Made it so simple
@user-jb3dz6pp1o
@user-jb3dz6pp1o 3 ай бұрын
This explanation was amazing. It was not complicated at all. Thank you.
@RDT
@RDT 3 ай бұрын
You're very welcome!
@ajsim
@ajsim Жыл бұрын
Great explanation. Thank you very much!
@francodominguez238
@francodominguez238 Ай бұрын
This is the most beautiful explanation I've ever heard, thank you
@RDT
@RDT Ай бұрын
Thank you! 🤩
@KerishaStewart
@KerishaStewart Жыл бұрын
good refresher! thanks much!
@FailNTry
@FailNTry 7 ай бұрын
One of the best video i watched in 5 mins well done ❤
@alisonoz7219
@alisonoz7219 Жыл бұрын
excellent explanation!! thank you so much!!
@roebienarnaiz
@roebienarnaiz Жыл бұрын
Concise! Great explanation.
@backtic_education
@backtic_education Жыл бұрын
Verrrrrrrrrrrrrry good explanation. Thank you so much.
@supernova82
@supernova82 2 жыл бұрын
This is great. Well done!
@tamimabdullah3624
@tamimabdullah3624 2 ай бұрын
the explanation was really helpful!
@zaeemjaved6850
@zaeemjaved6850 Жыл бұрын
BEST VIDEO ON THIS TOPIC! PERIOD!
@amityadav-np1rk
@amityadav-np1rk Жыл бұрын
Very well explained!! Thank you 🙏
@elobro9612
@elobro9612 Жыл бұрын
I'm a fresh graduate and currently working as a junior full-stack developer. I'm having a hard time learning the Promises and Async and this video really helps me a lot. Thank you so much!
@leoMC4384
@leoMC4384 8 ай бұрын
You had hard time learning Promises and you were a fresh graduate??? WTF?? You're a student having a hard time as a Project Manager now?? 😂😂😂
@elobro9612
@elobro9612 8 ай бұрын
@@leoMC4384 I'm a Senior Full Stack Dev now. Yey! 🥳🥳
@XX-vu5jo
@XX-vu5jo 6 ай бұрын
LOL he taught it the wrong way LOL!!!!!!!!!! you are clearly learning from wrong content, poor guy!!
@lakshmanchoudhary020
@lakshmanchoudhary020 Жыл бұрын
This video is really underrated, straight to the point in 5 minutes. Appreciate your efforts.
@RDT
@RDT Жыл бұрын
Thanks 🙏
@raziqijr
@raziqijr Жыл бұрын
this was one of the best explanation of async and promises !
@idanhen10
@idanhen10 11 ай бұрын
Amazingly explained!
@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 🙂
@Noraia
@Noraia Жыл бұрын
Best video about promises I watched so far!
@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 🙏
@d0m2288
@d0m2288 Ай бұрын
Great explanation, thank you.
@thishandharmakeerthi5327
@thishandharmakeerthi5327 Жыл бұрын
Hands down, Quality content 10/10. I subscribed the channel.
@jenkov2155
@jenkov2155 4 ай бұрын
Been a bit confused about the promises, async await, and try catch thing. But not anymore. Best explanation :D
@DnKZone
@DnKZone Жыл бұрын
thanks it's really clear to me what promise in js is
@TriNguyenuc-jc3fp
@TriNguyenuc-jc3fp 3 ай бұрын
Phenomenal explanation! You make my day sir
@RDT
@RDT 3 ай бұрын
Glad you liked it! Thanks
@zhaofour9833
@zhaofour9833 7 ай бұрын
The best explanation so far only uses 5 min and easy but illustrative example
@vampirekabir
@vampirekabir 2 жыл бұрын
well edited and well explained!!u deserve million subs
@RDT
@RDT 2 жыл бұрын
Thanks! We agree 😅
@Sammy-km9zk
@Sammy-km9zk Жыл бұрын
I love these kind of explainations
@DipanjanPatra
@DipanjanPatra 11 ай бұрын
Cleanest async/await explainer!
@nadeeshapiushan8468
@nadeeshapiushan8468 2 ай бұрын
This really helped. Thanks!
@somtoilo7465
@somtoilo7465 8 ай бұрын
This is perfect! Wow best explanation I've come across
@RDT
@RDT 8 ай бұрын
Wow, thanks!
@kadidibwa968
@kadidibwa968 Жыл бұрын
Clean and precise explanation
@oah8465
@oah8465 2 жыл бұрын
That was really smooth. Thank you.
@RDT
@RDT 2 жыл бұрын
Glad you liked it!
@nerdy561
@nerdy561 Жыл бұрын
Best explanation video out there!
@bartomiejsadecki8309
@bartomiejsadecki8309 2 жыл бұрын
Briliant video, very simple and easy to understand, it's nice that you're comparing the two in one short video. Thank you!
@RDT
@RDT 2 жыл бұрын
Thanks for your kind comments and support
@loydcose2780
@loydcose2780 Жыл бұрын
That was short and simple, thank you!
@RDT
@RDT Жыл бұрын
Thanks for your support Loyd
@tlilimourad5671
@tlilimourad5671 Жыл бұрын
Perfect explanation
@sanampakuwal
@sanampakuwal 2 жыл бұрын
Really smooth, subscribed!
@RDT
@RDT 2 жыл бұрын
Thanks Sanam
@jardelnunes6363
@jardelnunes6363 Жыл бұрын
such an awesome tutorial!!! thank you
@paulomarques9746
@paulomarques9746 Жыл бұрын
Amazing video, straight to the point. Thanks and congrats! 👏🏻 +1 subscriber
@mahdishirazi5785
@mahdishirazi5785 11 ай бұрын
this video is literally GOLD
@leonardmbibi8013
@leonardmbibi8013 6 ай бұрын
Well summarized, thanks
@YaBoiDallin
@YaBoiDallin Жыл бұрын
I've been trying to figure out promises and async for days and it finally makes sense. Thanks!
@chiomauche2138
@chiomauche2138 Жыл бұрын
perfect explanation!
Async JavaScript & Callback Functions -- Tutorial for Beginners
24:21
одни дома // EVA mash @TweetvilleCartoon
01:00
EVA mash
Рет қаралды 4,9 МЛН
Test Driven Development w praktyce PHP
23:20
Lenkowski
Рет қаралды 58
This is the Only Right Way to Write React clean-code - SOLID
18:23
Node.js is a serious thing now… (2023)
8:18
Code With Ryan
Рет қаралды 620 М.
Top 10 CSS One Liners That Will Blow Your Mind
13:34
developedbyed
Рет қаралды 871 М.
Promise in javascript | chai aur #javascript
50:21
Chai aur Code
Рет қаралды 171 М.
JavaScript Promises In 10 Minutes
11:31
Web Dev Simplified
Рет қаралды 1,7 МЛН
Every React Concept Explained in 12 Minutes
11:53
Code Bootcamp
Рет қаралды 284 М.
async await | Namaste JavaScript - Season 02 - Ep 04
1:09:21
Akshay Saini
Рет қаралды 209 М.