Тёмный

JavaScript Promises -- Tutorial for Beginners 

ColorCode
Подписаться 75 тыс.
Просмотров 105 тыс.
50% 1

JavaScript Promises and all their glory! This is episode 12 in a 10 part series I’m calling 10 things Javascript Developers Should Know But Probably Don't.
JavaScript Promises
Different phases of a Promise
Chaining Promises
Handling errors using Promises
Benefits over callbacks and callback hell
What do they all mean and why do you need them?
Full playlist here: • 20 Things JavaScript D...
JavaScript Promises from the series "10 Things JS Developers Should Know"
by ColorCode.io, Sina Jazayeri
** Announcement **
Full JavaScript Mastery course is coming! Details at the end of the video. Sign up for Early Access here:
www.colorcode.io/js-mastery
0:00:00 Intro
0:01:48 Async vs. Sync
0:03:29 The problem with Async
0:07:00 Convert to Callback
0:08:00 Convert to Promises
0:10:32 Different phases of a Promise
0:11:47 How to use a Promise
0:14:47 Why do we like Promises?
0:16:30 Chaining
0:20:59 Benefits of Promises over Callbacks
0:22:50 Error handling, REJECT and .catch()
0:30:23 .finally()
0:31:50 Real world example with fetch()
0:34:30 Summary
0:35:13 Next...

Опубликовано:

 

2 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 433   
@ColorCodeio
@ColorCodeio Год назад
🎉👨🏻‍💻 JavaScript Promises and all their glory! This is episode 12 of a 10 part series I’m calling 10 things Javascript Developers Should Know But Probably Don't. Enjoy!
@onlineaid
@onlineaid Год назад
Amazing series :)
@DanielNetSet
@DanielNetSet Год назад
12 out of 10? thats a out of bounds/stack overflow
@davidhusted817
@davidhusted817 Год назад
You promise 10 episodes but now in 12 😂😂
@extreme8879
@extreme8879 8 месяцев назад
Promises
@kiranrega10
@kiranrega10 21 день назад
Which js compiler are you using?
@Saliha_Abid
@Saliha_Abid Год назад
I am a 15 year old learning front-end development and struggling with promises. After 3 days of exhaustion I found ur video and finally got the whole concept. Thank you for this masterpiece 😍😍
@amanueletana
@amanueletana Год назад
This is not only coding tutorial rather its an ART!
@ColorCodeio
@ColorCodeio Год назад
♥️🙏
@user-gi3oc1kv5m
@user-gi3oc1kv5m Год назад
I’ve been watching videos for years trying to make sense of Promises, and while I got through it, I’ve always wanted to come back and really understand them. Your video turned the light bulb on for me. Wow! I had to tip you for the help! I appreciate it so much! Definitely subscribing!
@ColorCodeio
@ColorCodeio Год назад
That’s so great to hear. Thanks for sharing.
@deveren
@deveren 4 месяца назад
@@doublewhopper67 ure da g
@AJD...
@AJD... Год назад
Been watching your shorts for a while, decided to hop into your channel and this is the first video I watched. Holy hell the quality of your videos is mind blowing. You put so much effort into edits and your explanation is very planned, with a set preordained path which makes the most sense. You've got a new sub.
@ColorCodeio
@ColorCodeio Год назад
Thanks AJD. Very nice of you.
@lemonbubble1243
@lemonbubble1243 6 месяцев назад
3 days ago I wanted to watch just this video but the title made me look for the whole series, and I knew that to understand better I needed to watch the previous episodes, and OMG I'M GLAD I DID. I feel I have like a super knowledge now, EVERYTHING MAKES SENSE NOW!! I don't know how to express how grateful I am!! I'm so excited because you cleared all my doubts about promises and not just promises, now I understand Objects() way better! THANKS!! Waiting for your master class!!
@ColorCodeio
@ColorCodeio 6 месяцев назад
Glad to hear it! Full course coming soon.
@RaviCreative3-ge4ne
@RaviCreative3-ge4ne 6 месяцев назад
eagerly waiting man @@ColorCodeio
@AriKhuu
@AriKhuu Год назад
I'm so happy to be finding your channel I want to cry. Impeccable production. Clear examples. Perfect pacing - not too fast, not too sluggish. Detailed yet very follow-able explanation. Funny host. thank you thank you thank you.
@ColorCodeio
@ColorCodeio Год назад
Let’s cry together
@xClown55
@xClown55 Год назад
There aren't many video's that are 30+ minutes worth rewatching, but this one certainly is. Nice video
@user-eq9gs7bl2e
@user-eq9gs7bl2e Год назад
i can tell you put a lot of passion and effort into your work bro its inspiring
@guy_roh
@guy_roh Год назад
Thank you so much for making an actually apprehensive video that normal people can understand, explaining the why's and how's in a much better detail than a lot of other videos I've watched! Subscribed and added this to my favorites in case I should I need it in the future! 👍
@ColorCodeio
@ColorCodeio Год назад
Thanks Guy!
@stephenkettley
@stephenkettley 4 месяца назад
Man your content is so insightful and relaxed at the same time! Loving it.
@carsten1223
@carsten1223 9 месяцев назад
I just came across your channel. You have a really great way of explaining things and giving them some context. Thumbs up 👍and I'm looking forward to hopefully many more videos like this!
@vighneshs416
@vighneshs416 7 месяцев назад
I stumbled upon your channel from a random RU-vid shorts. I am very certain that soon you are going to be a lot of people's go-to channel for Javascript (Or anything that you make content on). The effort you put in to make the concepts intuitive is just top-notch. And I guess it is very evident from the other comments as well. Thanks for the effort you are putting in man
@blaqhakym
@blaqhakym 7 месяцев назад
Exactly the same for me. Looks like I will be here for a while. I'm hitting sub right away
@ColorCodeio
@ColorCodeio 7 месяцев назад
Thank you both! Welcome aboard.
@erickchavez4551
@erickchavez4551 10 месяцев назад
I really like how your examples lead to real life situations and at the end it doesn't seem that complicated. Thanks!
@ColorCodeio
@ColorCodeio 10 месяцев назад
Thanks!
@chaoticthundergod3368
@chaoticthundergod3368 8 месяцев назад
Thank you for this video. Leaned a lot. I was learning about promises a year ago, didn't understand much so skimmed through it. But now i can explain to others what a promise is.
@ColorCodeio
@ColorCodeio 8 месяцев назад
Wonderful!
@proudmoroccan8164
@proudmoroccan8164 4 месяца назад
Thank you for sharing. Immensely appreciated. The best JavaScript promise tutorial as far as I am concerned. Best wishes for the new year.
@ColorCodeio
@ColorCodeio 4 месяца назад
You are welcome!
@johnnya246
@johnnya246 Год назад
A very underrated channel. I like your style of teaching! Thank you for the content! Keep up the good work!
@ColorCodeio
@ColorCodeio Год назад
Thank you
@matickovac
@matickovac Год назад
This is by far the best explanation on the topic I have been able to find, and I must say I love your other videos as well. Love the production quality too, what is the recording software you're using, looks really slick?
@ColorCodeio
@ColorCodeio Год назад
The animations are all done by hand. The screen recording is just basic QuickTime.
@jasonblewis
@jasonblewis 17 дней назад
Excellent tutorial, thank you
@chetanchaudhary1017
@chetanchaudhary1017 4 дня назад
Best video on Promise I have ever watched.
@rjerez
@rjerez Год назад
Great work Sina, this is a subject that a lot of people seem to get wrong on interviews. Now I can refer them to this video. 👍🏽
@ColorCodeio
@ColorCodeio Год назад
Thank you Ronald for your support, always!
@abahiduh3246
@abahiduh3246 Год назад
I have watched the best vidoes of Kyle Simpson, Tyler McGinnis, Tony Alicea, colt Steele, Jim cooper, Aksay, Ania, Maximilian, Sasha, I can go on and on.... I spent A LOT of Money just to understand. I have watched ALL YOUR VIDEOS. I can assure you that this explanation got.YOUR EXPLANATION of SIMPLIFYING THE CODE before refactoring in simply the Best. Your tutorial is AMONGST THE BEST THREE for me. THANK YOU, THANK YOU, THANK YOU.
@ColorCodeio
@ColorCodeio Год назад
Thank you so much. This is very encouraging to hear.
@BitWizCoder
@BitWizCoder 9 месяцев назад
This is the first time I'm seeing this guy, 30 seconds into the video, and I had to subscribe. Thanks for the video and the fun!
@ahmedAltariqi
@ahmedAltariqi Год назад
That was pretty well explained, and FUN to watch ! Thank you, Weather Man!
@ColorCodeio
@ColorCodeio Год назад
Very welcome
@skyfall5288
@skyfall5288 19 дней назад
ممنونم بابت توضیحات عالیتون. واقعاً به این ویدئو نیاز داشتم... :)) ❤
@mashmixture5662
@mashmixture5662 Год назад
Learn alot from ColorCode in just one month. Such an amazing content. The way you explain things is very very very interesting and funny. *Best JS channel* on RU-vid. Thanks for such a premium content. Please deliver more.
@ColorCodeio
@ColorCodeio Год назад
Thanks a lot
@sourikray2291
@sourikray2291 Год назад
You are a wonderful teacher. Thank you for creating these videos🙏
@ColorCodeio
@ColorCodeio Год назад
Thank you!
@toohee8561
@toohee8561 Год назад
This will be the one video that gets me understand the basics concepts of promises. very good video outline and content.
@ferreven2558
@ferreven2558 Год назад
Thank you so much for this video! Finally someone who can explain promises well.
@ColorCodeio
@ColorCodeio 11 месяцев назад
Glad it was helpful!
@bakenbard
@bakenbard 4 месяца назад
That was really helpful, I'm finally got the basics of it. THANK YOU!
@bendustin7609
@bendustin7609 2 месяца назад
Thank you for putting out such high quality videos!
@user-kn4oi9oh4i
@user-kn4oi9oh4i 2 месяца назад
Thank you so much for this!! ❤❤❤❤
@mansoormohmand5852
@mansoormohmand5852 Год назад
I have seen lots of videos and tutorials but never use this topic of promises in my coding because of the bad and hard explanation, but now I am pretty sure I can use and refer to this great explanation ever, thanks a lot
@ColorCodeio
@ColorCodeio Год назад
👍
@jeffersonr.l2864
@jeffersonr.l2864 Год назад
This content is simply amazing! Thanks for your effort in creating quality content, I learn a lot thanks to it.
@ColorCodeio
@ColorCodeio Год назад
Awesome!
@msunrl8577
@msunrl8577 Год назад
24:28 u so right about repeating and coding from scratch again and again, this so important to memorize and practice some hands on great tutorial, thanks
@ColorCodeio
@ColorCodeio Год назад
🙏
@breemudi
@breemudi 10 месяцев назад
My first time ever watching you, and I'm intrigued by your tutoring style. Instant subscriber... Thank you
@ColorCodeio
@ColorCodeio 10 месяцев назад
Awesome, thank you!
@user-hs6jw1wm7i
@user-hs6jw1wm7i Год назад
Lot's of gratitude from me here Js Master, this series is really impacting me...
@ColorCodeio
@ColorCodeio Год назад
Glad to hear that ♥️
@sars8374
@sars8374 Год назад
Amazing explanation! I have been enjoying your series quite a lot. Looking forward to other videos. Btw, there is a small error in the video, fetch by default returns a Promise, we don't need to create it ourselves :) Have a nice day/night!
@godnonamesleft
@godnonamesleft Год назад
This is so well made. Thank you.
@ColorCodeio
@ColorCodeio Год назад
🙏
@halitturanarican3434
@halitturanarican3434 2 дня назад
Thank you very much. This cleared the concept for me :)
@mohamedabdulmueen2115
@mohamedabdulmueen2115 Год назад
I loved everything in this video man, keep it up !
@nitishgupta9585
@nitishgupta9585 Год назад
Bro your explanation of concepts is top notch. Keep the good work up!!
@ColorCodeio
@ColorCodeio Год назад
Thanks Nitish
@richardradcliffe6178
@richardradcliffe6178 Год назад
Thank you. Looking forward to your video on async awaits!
@ColorCodeio
@ColorCodeio Год назад
Thanks Richard. Coming soon.
@aleksazlatkovic4663
@aleksazlatkovic4663 Год назад
What a charismatic person you are. Good Lord. I started the video knowing nothing about Promises and I am finishing it as an absolute pro. Thank you for going into detail.
@ColorCodeio
@ColorCodeio Год назад
Thank you. Made my day.
@web3withbeny
@web3withbeny 3 месяца назад
Like the way that you teach, wonderful!
@eumm11
@eumm11 Год назад
always great, you never disappoint!
@ColorCodeio
@ColorCodeio Год назад
🙏
@16NaruSasuke
@16NaruSasuke Год назад
Thank you very much. Your videos are awesome, it is very clear what you are saying.
@ColorCodeio
@ColorCodeio Год назад
Awesome! 🤘🏼
@nikolanovakovic4150
@nikolanovakovic4150 7 месяцев назад
Brooooooooooooo 🎆🎇❤🧡💛💚💙💜 first of alll, love your humor, second of all amazing content struturing it is so well organized an succinct and i will do what all the other people in the comment section did compliment how good your videos are. much love !
@ColorCodeio
@ColorCodeio 6 месяцев назад
Thank you so much
@mikeyim9597
@mikeyim9597 Год назад
Glad I found your channel. It's the best explanation of the Promise and Async Await. Can you please do a series on the same topic for database CRUD? Thank you.
@ColorCodeio
@ColorCodeio Год назад
I'm considering doing one on CRUD operations with Firebase.
@mrayaan8377
@mrayaan8377 17 дней назад
You nailed it man.. best explanation on whole youtube. i was frustrated. but now i know the whole concept of promises. SUBSCRIBED🌞❤
@ColorCodeio
@ColorCodeio 17 дней назад
Glad it helped!
@krypton_dev
@krypton_dev 4 месяца назад
another GREAT video. Thanks a lot SINA
@sh9vch9nk0
@sh9vch9nk0 4 месяца назад
Great video, clear and detailed!) Thank you a lot 😊🙏
@strangelight159
@strangelight159 Год назад
5 minutes into the video and I can already tell that you are criminally underrated. Subbed
@ColorCodeio
@ColorCodeio Год назад
Hah thank you
@2difficult2do
@2difficult2do Год назад
Thus is the best explanation of Promise! Thank you so much!
@ColorCodeio
@ColorCodeio Год назад
You're very welcome!
@Gwgitu77
@Gwgitu77 3 месяца назад
Thanks for the clear explanation sir
@jw200
@jw200 10 месяцев назад
No Promises that I learned to Promise. Excellent tuts and explanations. Liked and subbed! Love your energy🙂
@ColorCodeio
@ColorCodeio 10 месяцев назад
Awesome! Thank you!
@akasharthanur3057
@akasharthanur3057 Год назад
You are just awesome, keep up your work... Learnt a lot!! Thanks for this... I love JavaScript!!
@StPQW
@StPQW Год назад
You rock!! 👑Thanks so much for your work!
@ColorCodeio
@ColorCodeio Год назад
Thank ya! 🙏🏼
@sergeysviridenko9603
@sergeysviridenko9603 11 месяцев назад
you're the best of 7 videos about promises I've seen
@ColorCodeio
@ColorCodeio 10 месяцев назад
✋✌️
@rishayshandilya1817
@rishayshandilya1817 10 месяцев назад
the best explanation of promises I promise :)
@Mashael_96
@Mashael_96 Год назад
Great explanation.. thank you 👏
@Epikht
@Epikht Год назад
Bro thank you for this amazing video
@renzodiaz5996
@renzodiaz5996 3 месяца назад
30:21 I can't believe Sina missed doing a "finally" pun when he literally was about to explain the "finally()" method. PD: Awesome video man! You teach us, you entertain us, you are a rockstar!
@ColorCodeio
@ColorCodeio 3 месяца назад
You're right. What a missed opportunity.
@nethunter1018
@nethunter1018 Год назад
Love the way you explain everything.❤❤ Can you make a video on hoisting in javascript and stuff like javascript execution context.
@nucleareggdevar
@nucleareggdevar Год назад
Phenomenal. Beyond phenomenal.
@ColorCodeio
@ColorCodeio Год назад
:)
@m47h4r
@m47h4r 7 месяцев назад
29:10 A usecase for passing in onError in the .then() is to provide fallback data. For example, if fun1 rejects and then if the onError returns some data, then having fun1().then(fun2, onError).then(onSuccess) means that the onSuccess function will always receive some data, either fun1 resolves successfully and it's all good and well, or onError happens and that provides a fallback value so that onSuccess can always assume it has some data.
@EducationSimplified
@EducationSimplified 5 месяцев назад
Awesome explanation, I thought it was a difficult thing but you made it way tooo simple. Thank you for your time and efforts. God may bless you a lot.❤❤
@ColorCodeio
@ColorCodeio 5 месяцев назад
Thank you!
@pandorofortes9309
@pandorofortes9309 9 месяцев назад
Thank you for the knowledge😁😁😁 Your channel is🔥🔥🔥🔥🔥
@ColorCodeio
@ColorCodeio 9 месяцев назад
I appreciate that!
@raheem81kg
@raheem81kg Год назад
Top quality as always
@theshtig4218
@theshtig4218 10 месяцев назад
GOATED video. This will be the last promise video I ever watch. Thank you!
@ColorCodeio
@ColorCodeio 10 месяцев назад
Appreciate it
@mira10045
@mira10045 Год назад
Please keep this JS series. I like your explanation!
@ColorCodeio
@ColorCodeio Год назад
It's going to continue :)
@hao12654
@hao12654 Год назад
@@ColorCodeio really nice video, please do continue!
@alanouri9965
@alanouri9965 Год назад
Very smooth,keep up the good work bro
@ColorCodeio
@ColorCodeio Год назад
Always
@tanjimulislamsabbir2264
@tanjimulislamsabbir2264 Месяц назад
Wow. That's a great one about promises. 💚
@ColorCodeio
@ColorCodeio Месяц назад
🙏
@Epikht
@Epikht Год назад
i'm gonna comment fort the third time, that is the best video about Promise all over this app I spend 2 days on it, messing around with my own things Thanks a lot Color Code
@ColorCodeio
@ColorCodeio Год назад
That’s awesome. Glad to hear it.
@GusGabriel
@GusGabriel 3 месяца назад
Thank you so much for your lessons, and have some fun coding also 😊😊
@ColorCodeio
@ColorCodeio 3 месяца назад
That's the goal!
@sarkorbekabdullaev9581
@sarkorbekabdullaev9581 Год назад
Thank you bro, can't wait for Episode 13 Async/Await
@ColorCodeio
@ColorCodeio Год назад
Coming soon
@hamraj1983
@hamraj1983 7 месяцев назад
Thanks for making it so easy to understand..🎉
@ColorCodeio
@ColorCodeio 5 месяцев назад
👍👍
@proghead00
@proghead00 Год назад
Have been watching your videos for a while. The production value is so good. Just wondering, what's this code editor that you're using here?
@ColorCodeio
@ColorCodeio Год назад
RunJS
@kayodekehinde3756
@kayodekehinde3756 Год назад
Cheers what a beautiful Teaching thank you so much for this Video!!!
@ColorCodeio
@ColorCodeio Год назад
Thanks for the comment Kayode
@johnforeverrules
@johnforeverrules Год назад
thank you so much Mr Sina. Promises confused me a lot. God bless
@ColorCodeio
@ColorCodeio Год назад
Glad to hear that
@redwansikder3847
@redwansikder3847 Месяц назад
Great explanation. 🙂
@ColorCodeio
@ColorCodeio Месяц назад
🙏
@onais__
@onais__ Год назад
UUFFFFF The Chaining explanation was 🔥🔥🔥
@xenocampanoli815
@xenocampanoli815 7 месяцев назад
BTW your "do it yourself" admonition reminds me of the advice at the beginning of all the old Charles Berlitz language tapes where he said: Read it, Hear it, Speak it. He may have also said "Write it" sometimes, but his point was memory reinforcement that is as functional as possible.
@ColorCodeio
@ColorCodeio 5 месяцев назад
🙏♥️
@imtanuki4106
@imtanuki4106 Год назад
Not sure if this is covered in another video, but a discussion of the event loop and micro/macro tasks might help put promises in context. Otherwise, great video!
@khalidsaifullahfuad
@khalidsaifullahfuad Год назад
Loved the intro 🔥.
@ColorCodeio
@ColorCodeio Год назад
Thanks 🔥
@RoockYou
@RoockYou 8 месяцев назад
Your explanation is so funny and so helpful at the same time, Hope you keep doing videos this way
@ColorCodeio
@ColorCodeio 8 месяцев назад
Ty!
@theultimategamer7202
@theultimategamer7202 Год назад
Great content as usual. Please upload video consistently
@ColorCodeio
@ColorCodeio Год назад
👍
@user-mw5bm2xh9x
@user-mw5bm2xh9x 7 месяцев назад
thanks for the lesson
@jatilyadav4000
@jatilyadav4000 Год назад
Thank You soo much for such amazing video...
@ColorCodeio
@ColorCodeio Год назад
🙏
@oncoding4520
@oncoding4520 Год назад
Love your work
@ColorCodeio
@ColorCodeio Год назад
Thank you!
@lifeofjoel9629
@lifeofjoel9629 14 дней назад
Thanks for the content. This really helped me understand the concept!
@ColorCodeio
@ColorCodeio 6 дней назад
Nice!
@blu3tan
@blu3tan 4 месяца назад
nice setup, nice host, nice code, nice music, nice edit, nice english
@avigarg7859
@avigarg7859 11 месяцев назад
You teach so creatively
@ColorCodeio
@ColorCodeio 10 месяцев назад
Thanks
@rohanagrawal5747
@rohanagrawal5747 Год назад
yeeeee i was waiting for this video
@yiroyi2894
@yiroyi2894 Год назад
Your videos are amazing, very clear, it helped me a lot to finally understand the Promise concept
@ColorCodeio
@ColorCodeio Год назад
Amazing
@sujith.m.s4041
@sujith.m.s4041 7 месяцев назад
I got stuck in promise and call back for like 2 days, this reslly helped a lot
@ColorCodeio
@ColorCodeio 5 месяцев назад
Nice
@tetianazhuchenko2182
@tetianazhuchenko2182 Год назад
Thanks a lot. You are doing a great job 👏 👍
@ColorCodeio
@ColorCodeio Год назад
Thanks!
@Walid-Sahab
@Walid-Sahab Год назад
جانی بہترین ہوگیا 🔥 🤍
@ariseawake3437
@ariseawake3437 Год назад
I am giving a Promise that i will do practice and learn with this video ....Thank you
@ColorCodeio
@ColorCodeio Год назад
hah nice!
@ajayrathod7438
@ajayrathod7438 4 месяца назад
I loved your video like every other specially your sence of humor. Can you make one video on Promise.All if possible.
@ColorCodeio
@ColorCodeio 4 месяца назад
👍
Далее
WOW... WHAT A FIGHT!!!!! 📣 #ufc302
00:48
Просмотров 852 тыс.
SITUATION IN FAST FOOD
00:19
Просмотров 3,5 млн
Все мы немного Адриана 😂😂😂
00:11
Fetch API - JavaScript Tutorial for beginners
30:50
Просмотров 88 тыс.
JavaScript Closures Tutorial (Explained in depth)
19:03
DOM API - JavaScript Tutorial for beginners
42:17
Просмотров 27 тыс.
Ten Steps to Mastering the Fetch API
2:19:52
Просмотров 39 тыс.
WOW... WHAT A FIGHT!!!!! 📣 #ufc302
00:48
Просмотров 852 тыс.