Javascript Promises vs Async Await EXPLAINED (in 5 minutes)

  Рет қаралды 563,197

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

Пікірлер: 730
@atatdotdot
@atatdotdot 11 ай бұрын
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 11 ай бұрын
Good catch, thanks. Pinning this comment.
@paulhetherington3854
@paulhetherington3854 10 ай бұрын
Only if - there be - () call f(x) - pre amp d(x)! It never did - ught yet?
@jellyjollyjelly9513
@jellyjollyjelly9513 6 ай бұрын
"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 5 ай бұрын
@@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 5 ай бұрын
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 4 ай бұрын
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 Жыл бұрын
I just want to call another api using first call's result. What method I have to follow ?
@mohamedafrid1349
@mohamedafrid1349 Жыл бұрын
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
@miladevs
@miladevs Ай бұрын
Great analogy with the waiter bringing coffee to explain promises! It really clarifies how promises work in JavaScript. Using then and catch makes handling asynchronous operations much cleaner. Thanks for breaking it down so well, Kyle!
@kunikaingale4704
@kunikaingale4704 Жыл бұрын
bruh why so underrated?! Such a marvellous explanation, straight to the point
@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
@hamzadlm6625
@hamzadlm6625 Жыл бұрын
The first person I watch to not explain 1 phrase using 20 phrases, neat and straight to the point! thank you.
@ChaDaeyeob
@ChaDaeyeob 11 ай бұрын
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 11 ай бұрын
You're very welcome!
@chrislione950
@chrislione950 Жыл бұрын
Wow,this is hands down the best explanation of this topic. Thanks alot
@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!
@sadhappy8860
@sadhappy8860 9 ай бұрын
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!
@PerryCS2
@PerryCS2 Жыл бұрын
I really like how you add the code to the video AS you explain it... helps break things down...
@wassimmouloud3432
@wassimmouloud3432 Жыл бұрын
the way you explain things is just perfect
@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 🙏
@mushroomthump
@mushroomthump Жыл бұрын
I was so confused about this, cleared it up for me, thanks!
@mattmcrae
@mattmcrae 7 ай бұрын
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 7 ай бұрын
Excellent!
@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 🙏
@huangtiantian8770
@huangtiantian8770 Жыл бұрын
Thanks! This is the best video explaining await and promises I have ever seen
@jenkov2155
@jenkov2155 7 ай бұрын
Been a bit confused about the promises, async await, and try catch thing. But not anymore. Best explanation :D
@vegeta4614
@vegeta4614 2 жыл бұрын
This is really helpful. Will go through all ur javascript turorials now
@GovindYaswanth
@GovindYaswanth Жыл бұрын
Had listened to lot of videos and read articles. But Wow!!! Yours is best explained and perfect real time example... Love it Man!!!
@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!
@venkateshak.s9290
@venkateshak.s9290 Жыл бұрын
Very neat n crisp information without any extra buzz! 🤗👏
@zhaofour9833
@zhaofour9833 10 ай бұрын
The best explanation so far only uses 5 min and easy but illustrative example
@MichaelKim505
@MichaelKim505 4 ай бұрын
Truely helpful and insightful explanation on Promise with good examples.
@wtf_jokes9639
@wtf_jokes9639 Жыл бұрын
What an absolute break down. I wish all teachers had the touch to teach like you
@XX-vu5jo
@XX-vu5jo 8 ай бұрын
LOL he taught it the wrong way LOL!!!!!!!!!! you are clearly learning from wrong content, poor guy
@richk5015
@richk5015 4 ай бұрын
Thank you, Chris, for explaining everything so eloquently. 🙏
@RDT
@RDT 4 ай бұрын
My pleasure!
@comrade_rahul_1
@comrade_rahul_1 3 ай бұрын
This was the first I understood async, await! Amazing video. 🤗
@RDT
@RDT 3 ай бұрын
Awesome! Thank you!
@francodominguez238
@francodominguez238 4 ай бұрын
This is the most beautiful explanation I've ever heard, thank you
@RDT
@RDT 4 ай бұрын
Thank you! 🤩
@user-jb3dz6pp1o
@user-jb3dz6pp1o 5 ай бұрын
This explanation was amazing. It was not complicated at all. Thank you.
@RDT
@RDT 5 ай бұрын
You're very welcome!
@barteg_s
@barteg_s 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
@chrisstrauss7288
@chrisstrauss7288 Жыл бұрын
Best explanation iv seen on this to date. Cleared up a lot for me
@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 🙂
@eidercarlos6391
@eidercarlos6391 Жыл бұрын
Great! The best explanation about the topic I've seen! Thanks!
@Aziz-kw6ct
@Aziz-kw6ct 4 ай бұрын
Your explanation was perfect, thank you for the effort.
@RDT
@RDT 4 ай бұрын
Glad it was helpful!
@farhadahmed2007
@farhadahmed2007 3 күн бұрын
What an incredible and simple explanation. Thanks for this!
@RDT
@RDT 3 күн бұрын
Glad it was helpful!
@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!
@danglad5546
@danglad5546 Жыл бұрын
Great simple explanation, you are very good at it.
@AbhishekTiwari-xt1kt
@AbhishekTiwari-xt1kt 2 жыл бұрын
Wow, nicely explained, short and sweet No BS
@suntoshaqula
@suntoshaqula 3 ай бұрын
crisp clear straight to the point no bullshit awesome tutorial
@RDT
@RDT 3 ай бұрын
Thanks pal
@joepage3065
@joepage3065 2 жыл бұрын
Very clear and concise explanation. Thanks 👍
@jalalkhan3166
@jalalkhan3166 4 ай бұрын
Promises & async await ARE PROUD OF YOU. such explanation💛
@RDT
@RDT 4 ай бұрын
Thanks 🙏
@FailNTry
@FailNTry 9 ай бұрын
One of the best video i watched in 5 mins well done ❤
@josecarlosgarcia6477
@josecarlosgarcia6477 Жыл бұрын
this is the best explanation on KZbin, Thanks
@djrmarketing598
@djrmarketing598 3 ай бұрын
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 3 ай бұрын
Thanks
@raziqijr
@raziqijr Жыл бұрын
this was one of the best explanation of async and promises !
@samichosen524
@samichosen524 Жыл бұрын
Amazing presentation and great explanation, thanku
@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 🙂
@alexander5052
@alexander5052 Жыл бұрын
Awesome explanation! Thank you
@ajsim
@ajsim Жыл бұрын
Great explanation. Thank you very much!
@thishandharmakeerthi5327
@thishandharmakeerthi5327 Жыл бұрын
Hands down, Quality content 10/10. I subscribed the channel.
@tungpho2132
@tungpho2132 11 ай бұрын
Jesus, your explanation literally make me happy and smiling reading the code, 10/10
@RDT
@RDT 11 ай бұрын
Thanks! 🙏
@tanjimulislamsabbir857
@tanjimulislamsabbir857 5 ай бұрын
This is very clear and organised video. I loved it.❤
@svalyavasvalyava9867
@svalyavasvalyava9867 5 ай бұрын
Thank you infinitely for the clear explanation 😊
@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 🙏
@oguzhanaydn7482
@oguzhanaydn7482 Жыл бұрын
very good and instructive video, i get it better now thank you
@somtoilo7465
@somtoilo7465 10 ай бұрын
This is perfect! Wow best explanation I've come across
@RDT
@RDT 10 ай бұрын
Wow, thanks!
@backtic_education
@backtic_education Жыл бұрын
Verrrrrrrrrrrrrry good explanation. Thank you so much.
@neetujoshi6005
@neetujoshi6005 Жыл бұрын
Subscribed...short/simple easy to understand.
@normanluismadrid422
@normanluismadrid422 Жыл бұрын
beautifully explained, thanks for this
@mahdishirazi5785
@mahdishirazi5785 Жыл бұрын
this video is literally GOLD
@wrathofainz
@wrathofainz Жыл бұрын
Before now I've had the hardest time even accessing the contents of a promise. It was like a black box. Thanks for the vid.
@Noraia
@Noraia Жыл бұрын
Best video about promises I watched so far!
@keyvanhosseini3518
@keyvanhosseini3518 Жыл бұрын
This video was so useful, thank you for creating it. 🙂🙂
@nichi785
@nichi785 Жыл бұрын
Perfect explanation!!!, I always had doubts about the use of async-await x .then().catch(), and your didactic explanation this content helped me a lot. from Brazil ^^
@RDT
@RDT Жыл бұрын
Thanks for you kind comments and support of the channel
@tassneemaltaf2001
@tassneemaltaf2001 Жыл бұрын
Loved the explanation
@ahmedshafraz1538
@ahmedshafraz1538 Ай бұрын
Awesome and simple explanation ❤
@DipanjanPatra
@DipanjanPatra Жыл бұрын
Cleanest async/await explainer!
@gravitasfolly8615
@gravitasfolly8615 Жыл бұрын
Excellent tutorial. Made it so simple
@Jeremiahking101
@Jeremiahking101 Жыл бұрын
This literally made my day! THANK YOU!
@DnKZone
@DnKZone 2 жыл бұрын
thanks it's really clear to me what promise in js is
@philipackerley5775
@philipackerley5775 Жыл бұрын
Superbly put together Chris, never heard or seen it explained as well 😇
@RDT
@RDT Жыл бұрын
Wow, thank you 🙏😊
@returnMarcco
@returnMarcco Жыл бұрын
It's Rob
@idanhen10
@idanhen10 Жыл бұрын
Amazingly explained!
@returnMarcco
@returnMarcco Жыл бұрын
Thanks for the video Rob
@KerishaStewart
@KerishaStewart Жыл бұрын
good refresher! thanks much!
@someguynamedvictor
@someguynamedvictor 11 ай бұрын
Beat explanation of these two concepts I’ve ever heard. 👍
@RDT
@RDT 10 ай бұрын
That’s really kind, thank you
@tamimabdullah3624
@tamimabdullah3624 5 ай бұрын
the explanation was really helpful!
@MorphTW
@MorphTW 4 ай бұрын
Thanks. Was watching a lot of videos on using promises and async await keywords but i was always missing few key details and was confused with mixing of .than and .catch with await.... I got it now.
@RDT
@RDT 3 ай бұрын
That’s great, glad it helped
@zaeemjaved6850
@zaeemjaved6850 Жыл бұрын
BEST VIDEO ON THIS TOPIC! PERIOD!
@viktorste
@viktorste Жыл бұрын
Wow, brilliant. I knew all this, but I would never explain it like in this video in 1000 years.
@RDT
@RDT Жыл бұрын
Thank you 🙏
@d0m2288
@d0m2288 4 ай бұрын
Great explanation, thank you.
@leonardmbibi8013
@leonardmbibi8013 9 ай бұрын
Well summarized, thanks
@YaBoiDallin
@YaBoiDallin Жыл бұрын
I've been trying to figure out promises and async for days and it finally makes sense. Thanks!
@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 11 ай бұрын
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 11 ай бұрын
@@leoMC4384 I'm a Senior Full Stack Dev now. Yey! 🥳🥳
@XX-vu5jo
@XX-vu5jo 8 ай бұрын
LOL he taught it the wrong way LOL!!!!!!!!!! you are clearly learning from wrong content, poor guy!!
@allhailalona
@allhailalona 5 ай бұрын
I really liked this video: A. I like Harry Potter, and your accent reminds me of stephen fry reading the book B. the explanation is actually short and concise, and the editing is quite nice too, something u don't see a lot around...
@RDT
@RDT 5 ай бұрын
Thank you! 🙏 I’ve not been compared to Stephen Fry before, an honour 😎
@Arnavfellasleep
@Arnavfellasleep Ай бұрын
such a good explanation. Thanks.
@paulomarques9746
@paulomarques9746 Жыл бұрын
Amazing video, straight to the point. Thanks and congrats! 👏🏻 +1 subscriber
@drakZes
@drakZes Жыл бұрын
Best Promise explanation I have ever seen in my life!!!
@RDT
@RDT Жыл бұрын
Wow, thank you! 🙏
@baderelhayah7961
@baderelhayah7961 Жыл бұрын
Thanks for the video, this is very helpful
@ultragamersvk1668
@ultragamersvk1668 11 ай бұрын
Thanks for not making it too complicated like other youtubers, You are awesome
@RDT
@RDT 11 ай бұрын
I appreciate that! Thanks for your support of the channel
@InderjeetSingh-zm3sf
@InderjeetSingh-zm3sf Жыл бұрын
Loved the explanation....it helped alot thanks!!!!
@sekki2554
@sekki2554 8 ай бұрын
Very well explained!
@Sammy-km9zk
@Sammy-km9zk Жыл бұрын
I love these kind of explainations
@Nneoh1
@Nneoh1 Жыл бұрын
Phenomenal explanation, thank you!
@DamianDemasi
@DamianDemasi Жыл бұрын
Great explanation! Thanks for the video :)
@prasadkadu9737
@prasadkadu9737 Жыл бұрын
The editing is top class
Async JavaScript & Callback Functions -- Tutorial for Beginners
24:21
Llegó al techo 😱
00:37
Juan De Dios Pantoja
Рет қаралды 22 МЛН
تجربة أغرب توصيلة شحن ضد القطع تماما
00:56
صدام العزي
Рет қаралды 57 МЛН
Mom's Unique Approach to Teaching Kids Hygiene #shorts
00:16
Fabiosa Stories
Рет қаралды 12 МЛН
Clowns abuse children#Short #Officer Rabbit #angel
00:51
兔子警官
Рет қаралды 73 МЛН
5 Signs of an Inexperienced Self-Taught Developer (and how to fix)
8:40
JavaScript Pro Tips - Code This, NOT That
12:37
Fireship
Рет қаралды 2,5 МЛН
What are JavaScript PROMISES? 🤞
12:37
Bro Code
Рет қаралды 47 М.
Whats the Difference Between Callbacks and Promises?
8:39
Coding With Chaim
Рет қаралды 16 М.
Просто o async, await. Без циклов и таймеров. JavaScript
15:55
WebDev с нуля. Канал Алекса Лущенко
Рет қаралды 97 М.
This is the Only Right Way to Write React clean-code - SOLID
18:23
JavaScript ES6 Arrow Functions Tutorial
9:32
Web Dev Simplified
Рет қаралды 822 М.
The Async Await Episode I Promised
12:04
Fireship
Рет қаралды 1,1 МЛН
Tips For Using Async/Await in JavaScript
16:26
James Q Quick
Рет қаралды 395 М.
5 JavaScript Concepts You HAVE TO KNOW
9:38
James Q Quick
Рет қаралды 1,4 МЛН
Llegó al techo 😱
00:37
Juan De Dios Pantoja
Рет қаралды 22 МЛН