How Async Javascript works (Callback Hell, Promises, Async Await, Call Stack and more)

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 พ.ย. 2024

ความคิดเห็น • 136

  • @developedbyed
    @developedbyed  ปีที่แล้ว +117

    I think it would be really fun if we did a series on focusing on one specific aspect of Javascipt and make a fun series out of it!
    Example: A full episode on event handlers (how to make a custom one, how it works, etc etc) 👀
    Let me know if you like the idea 🔥
    Anyone playing Street Fighter 6?

    • @yoJuicy
      @yoJuicy ปีที่แล้ว +2

      Great ideas Ed! thanks for teaching. Youre hitting 1 million this year bro! I love the idea of intermediate/advanced concepts because often times people explain things shallowly in their examples (for time) so its difficult to understand concepts when you want to use them in your own way.
      Other concepts that are kinda important: prop drilling (now with client & server comps this is critical) Closures [functional programming], prototypes, OOP, event loop, Linked list, Hash, BFS, DFS.
      Cheers

    • @belkocik
      @belkocik ปีที่แล้ว

      That would be nice :)

    • @dev_franqqi
      @dev_franqqi ปีที่แล้ว

      That sounds fire

    • @joseduargu
      @joseduargu ปีที่แล้ว

      amazing idea

    • @marshall-brown
      @marshall-brown ปีที่แล้ว

      Yes, full send that idea!

  • @Ndzzle
    @Ndzzle ปีที่แล้ว +7

    SetTimeout is a webAPI. This gets handled by the browser instead of JavaScript. So instead of going staight into the queue, it goes into the WebAPI stack until the time is up. Then gets pushed into the queue, behind the other logs which is why it shows up last

  • @ashmitsharma9096
    @ashmitsharma9096 ปีที่แล้ว +3

    Correction: 9:36 CallStack works on LIFO and Callback queue works on FIFO.
    ⚠Warning Your this video is now obsolete:
    th-cam.com/video/_8gHHBlbziw/w-d-xo.html&t

  • @SarveshSawant-zk7xy
    @SarveshSawant-zk7xy ปีที่แล้ว +1

    02:13 - Two types of context
    06:54 - first console log, third and then second is called because of call stack
    08:22 - Call Stack
    14:54 - Call Back Hell
    19:50 - Custom Promise Example
    22:43 - Real word promise example
    26:35 - Async and await example

  • @gambomaster
    @gambomaster ปีที่แล้ว +43

    Thanks again my gorgeous teacher on the internet. 🙏

  • @shs4293
    @shs4293 ปีที่แล้ว +2

    Been working on Js since years but trust me, haven't found callbacks & promises being explained like this, even a junior dev could understand this without any hassle.

  • @patricklemmer-adeveloperss3458
    @patricklemmer-adeveloperss3458 ปีที่แล้ว +1

    THE best video I personally have seen about these concepts. I have started learning how to code early last year and JS is still very difficult for me at time. This video has helped me understand things in 30 mins that I have not understood in the last 1.5 years. Huge compliment and please keep doing these basic concept JS videos, they are gold!

  • @anna-booklove
    @anna-booklove ปีที่แล้ว +2

    Great timing! I‘m working as a react developer for 1 1/2 years now and sometimes I‘m just not aware of some of this concept. This was super interesting to get a little refresher and a deeper understanding!

  • @RychAhlberg
    @RychAhlberg ปีที่แล้ว +3

    You’re so good at explaining thoroughly. Thank you very much!

  • @robgioeli
    @robgioeli ปีที่แล้ว +6

    I’ve been coding for close to 8 years now and have been been watching videos for quite many years and I’d just like let you know that your recent videos have been gold. I think the basics and creating clones of apps are long overplayed and many people will benefit from videos like this. Awesome teacher, would love to see you teach people more technical stuff like you have been the last month 👍🏻🔥

  • @yanndjoumessi7130
    @yanndjoumessi7130 ปีที่แล้ว +5

    That's definitely a great video to put everything in context. I personally would like to see such a format with different JS topics. I don't think that it's really entertaining but for people loving to understand deeply what's going on, it's definitely a much better approach.

  • @getrogo4474
    @getrogo4474 ปีที่แล้ว +2

    7:56 caught me off guard hahahahahaha

  • @anonygsc6851
    @anonygsc6851 ปีที่แล้ว +3

    Hi Ed, I really appreciate your videos as i decided to use a JS framework to rewrite a project that was pooly optimised in a different technology. It really helps to watch someone when reading docs becomes tiring. Thanks

  • @SolidJello
    @SolidJello 3 หลายเดือนก่อน

    The first video that actually got straight to it with live examples and helped.

  • @vinci-g
    @vinci-g ปีที่แล้ว +1

    "Time's up m*therf*cker!" Had me on the floor rolling LMAO

  • @костякосогоров-з9о
    @костякосогоров-з9о 5 หลายเดือนก่อน

    This is the first TH-cam video that made me happy, thank you my friend, I've wanted to understand this topic for so long and finally I found someone who could describe the workings of JavaScript so thoroughly.

  • @realworldcodingapplications
    @realworldcodingapplications ปีที่แล้ว

    i absolutely enjoy this kind of humor when I'm learnign to program, so thank you for that! Makes learnign much less mind numbing

  • @srikarravoori124
    @srikarravoori124 10 หลายเดือนก่อน +1

    After a long, I see you. By the way seeing your video I happened to become a software engineer at the age of 41 and completing 3 years now

  • @alfiartya23
    @alfiartya23 ปีที่แล้ว +1

    As always, the way Ed teaching me with his funny way that makes me easily understand again about this context. I remember first time I learn Javascript is from Ed JS playlist, so thank you so much Ed! 😄

  • @deepakroy3459
    @deepakroy3459 ปีที่แล้ว +1

    I am telling you,This guy is a GEM❤

  • @saadafm
    @saadafm 5 หลายเดือนก่อน

    This is EASILY the best video on these topics

  • @CristianKirk
    @CristianKirk ปีที่แล้ว

    Super nice to see actual programming in this channel and not just trendy frameworks conventions.

  • @ichiroutakashima4503
    @ichiroutakashima4503 ปีที่แล้ว +1

    I love this. Always good to watch such concepts because it's a refresher.

  • @iitz_danny
    @iitz_danny ปีที่แล้ว

    I just had an interview that went over these concepts too. Wish I would have watched this video beforehand. I’m definitely turning on the notifications now😅

  • @justfun591
    @justfun591 4 หลายเดือนก่อน

    This video is must watch if you're are going for an interview

  • @es2cs
    @es2cs ปีที่แล้ว +1

    7:55 im going to say this everytime I run a setTimeout from now on 🤷‍♂️😂

  • @Kuramas_Chakra
    @Kuramas_Chakra ปีที่แล้ว +1

    Microsoft's True Intention Leaked at 7:18 !

  • @cmdrTremyss
    @cmdrTremyss ปีที่แล้ว

    Love the new format, I think I finally get how async works

  • @aftonlawver3827
    @aftonlawver3827 ปีที่แล้ว

    Great explanation of the call stack vs the web API's and event loop!

  • @Pareshbpatel
    @Pareshbpatel ปีที่แล้ว +2

    Async JS; nicely explained. Thanks, Ed
    {2023-06-27}

  • @ways.
    @ways. 7 หลายเดือนก่อน

    this is my new favorite channel

  • @CodeWithCGPT
    @CodeWithCGPT 5 หลายเดือนก่อน

    Hi Man I am seeing you after three years thanks good
    your video very help for me when I am fresher

  • @testingBuyer
    @testingBuyer 10 หลายเดือนก่อน

    wonderful and precise tutorial ,wins a subscription

  • @maherylala2153
    @maherylala2153 ปีที่แล้ว

    Really waited for that one from you, thanks !

  • @enigmaSpy
    @enigmaSpy ปีที่แล้ว

    Nawet nie zdajesz sobie sprawy jak bardzo długo szukałem tego typu video, spadłeś mi po prostu z nieba❤

  • @Antonio-yn4mb
    @Antonio-yn4mb ปีที่แล้ว +1

    When your team leader is Samuel L. Jackson 7:55

  • @bareenlars
    @bareenlars 7 หลายเดือนก่อน +1

    Hi, great video! New to promises and await, @26:45 why do we need to await when creating the const data ? isnt the variable response already set/saved? or is it just a placeholder for the function? If so, the await command is already in the response variable. Just trying to understand :)

  • @RVAraghav
    @RVAraghav ปีที่แล้ว

    I have been following you for many years now and the excitement never stops when I see your video every time. Btw the video clarity is fantastic. What’s the camera you’re using? ❤

  • @ahmadbilalfarooqi
    @ahmadbilalfarooqi ปีที่แล้ว

    i gona revised function and your teaching way is sooo awesome
    async function is more than easy by Promise

  • @encourage-fm3fo
    @encourage-fm3fo ปีที่แล้ว

    This was fantastic! Exactly what I was looking for.

  • @mostafakheder7721
    @mostafakheder7721 ปีที่แล้ว

    Nice work , I believe this episode is great

  • @endritibra4351
    @endritibra4351 ปีที่แล้ว

    This was a masterpiece by Ed, a comment from an experienced developer

  • @anandumdharan6283
    @anandumdharan6283 ปีที่แล้ว +1

    Much needed bruddah......thanks a lot ed

  • @diganta64
    @diganta64 11 หลายเดือนก่อน

    One of the best session watched..:)

  • @deepanshusharma9311
    @deepanshusharma9311 ปีที่แล้ว

    WOW🤩 Very nice Explanation

  • @DawFa10
    @DawFa10 ปีที่แล้ว

    Great video, and really well explained on the different concepts!

  • @hiafraan
    @hiafraan ปีที่แล้ว

    Thank you for the great explanation! ❤️

  • @chhavimanichoubey9437
    @chhavimanichoubey9437 ปีที่แล้ว

    I was unable to hold myself when you said 2000 seconds.

  • @paulthomas1052
    @paulthomas1052 ปีที่แล้ว

    Great demo and explanation. Cheers !

  • @momomadi2
    @momomadi2 ปีที่แล้ว

    nice explanation -- thanks bro

  • @apex-lazer
    @apex-lazer 11 หลายเดือนก่อน +1

    Faking luv you eddy Boiii!

  • @juliensavary
    @juliensavary ปีที่แล้ว

    worker threads are changing the single threaded nature of js

  • @БогданЯцентюк-ч9ч
    @БогданЯцентюк-ч9ч 11 หลายเดือนก่อน

    Thank you! Good and useful content 😎

  • @parsina4971
    @parsina4971 ปีที่แล้ว

    thanks pal❤❤

  • @kimhwanhoon
    @kimhwanhoon ปีที่แล้ว

    Love it thank you so much man!

  • @KaiaLoken
    @KaiaLoken 7 หลายเดือนก่อน

    Thank you for this

  • @ankamsarav
    @ankamsarav 8 หลายเดือนก่อน

    I feel the remove function which you showed stacking in call stack section is wrong because queue will not push the functions unless the stack is empty

  • @nareshg128
    @nareshg128 3 หลายเดือนก่อน

    just awesome .

  • @pfcokelly
    @pfcokelly ปีที่แล้ว +1

    Tik tok, times up MFer. Great lesson!

  • @joshuamackinnon1250
    @joshuamackinnon1250 ปีที่แล้ว

    Great video!

  • @MaxenGaynier28
    @MaxenGaynier28 ปีที่แล้ว

    Dr. Strange is teaching programming now? That's cool..

  • @fried-eggscelleration
    @fried-eggscelleration 8 หลายเดือนก่อน

    Nice video, but how can I get a value from the response returned as part of the function? Seems like the return value of a async function is always a promise? how can I get even maybe a wrapper function to just give me a string in the end, after waiting for the result?

  • @JohanDeGroot1982
    @JohanDeGroot1982 ปีที่แล้ว

    THANK YOU!!!

  • @Richard-LaFleur
    @Richard-LaFleur ปีที่แล้ว

    9:28 Shouldn't it get pushed one by one, only when previous removeTodo() finishes and call stack is empty, and not everything at once?

  • @robgioeli
    @robgioeli ปีที่แล้ว

    Hey ed 👋🏼 also if you like live wallpaper, Razer makes amazing high quality software that I think called Cortex? High quality live wallpaper 👍🏻 best I’ve used!

  • @nickveldkamp5396
    @nickveldkamp5396 ปีที่แล้ว

    Do u create also a video about Axios ;) ?

  • @aps69
    @aps69 ปีที่แล้ว

    Add those chapters Ed

  • @spaceageboys3485
    @spaceageboys3485 หลายเดือนก่อน

    Made my setTimeout for 2000 seconds and waited over half an hour…

  • @andreeapurta457
    @andreeapurta457 3 หลายเดือนก่อน

    I wanted to find out how the promise and async func looks on stack/queue/api...

  • @fullstackspiderman
    @fullstackspiderman ปีที่แล้ว

    @Ed, could you please create testing React App courses or TH-cam videos using RTL, Vitest for unit and integration and Cypress for E2E testing

  • @chaimaegrich4510
    @chaimaegrich4510 ปีที่แล้ว

    Hi Ed, can I get the name of the music in the background please

  • @AyanleDirie
    @AyanleDirie 5 หลายเดือนก่อน

    what extension do you use to have icons like that?

  • @SecondBekfast
    @SecondBekfast ปีที่แล้ว

    Are you using an OLED tv as a monitor?

  • @singingrockstar9698
    @singingrockstar9698 ปีที่แล้ว +1

    😂😂😂 tick tock tik took tiMesuP !!!😅

  • @jayaprakash_dev
    @jayaprakash_dev ปีที่แล้ว

    do the web APIs run in different threads?

  • @TUSHARMORE_09
    @TUSHARMORE_09 6 หลายเดือนก่อน

    Thanks! to Gorgeous teacher on internate 💝❤

  • @kvebalas5931
    @kvebalas5931 ปีที่แล้ว

    9:30 First in First out doesn't work that way. It pushes on top, but process the first (oldest) one on the bottom.

    • @zeusor
      @zeusor ปีที่แล้ว

      He meant Last in First out LiFo I guess

  • @Terms-and-Conditions
    @Terms-and-Conditions ปีที่แล้ว

    Would it look better if you flip/mirror your camera horizontal? so it looks like you are looking at the actual content while showing it to us

  • @gorkemtr
    @gorkemtr ปีที่แล้ว

    thks, take care of your health

  • @SebastianOnofrei
    @SebastianOnofrei ปีที่แล้ว

    I was very concentrated on what you explain then you came with the ' tick tac , tick tac , tick tac , time is up mothafucka' :)))) MY BELLY HURT BECAUSE OF LAUGHING . Other than that , excellent explanations ! Multumesc frumos ;) !

  • @morale3056
    @morale3056 ปีที่แล้ว

    Damn! Nice and easy!

  • @vitaminprutin8217
    @vitaminprutin8217 ปีที่แล้ว

    loved it

  • @vanshshah7781
    @vanshshah7781 ปีที่แล้ว

    Amazing

  • @andrewSantosMaia
    @andrewSantosMaia ปีที่แล้ว

    You re really funny!

  • @anony88
    @anony88 ปีที่แล้ว

    Ed I need another video like this but explain it to me like I'm 12 lol

  • @nasratt
    @nasratt ปีที่แล้ว

    What is that VSCode theme? anyone knows?

  • @zeusor
    @zeusor ปีที่แล้ว

    I think he meant Last in First out LiFo 9:36

  • @TJPBataller
    @TJPBataller 8 หลายเดือนก่อน

    I thought callstack is FILO. or FIFO? not sure anymore.

  • @naczelnypsycholog6296
    @naczelnypsycholog6296 ปีที่แล้ว +1

    love the sweater❤, no homo

  • @manshulduggal5482
    @manshulduggal5482 ปีที่แล้ว

    2:30

  • @ServanFICHET
    @ServanFICHET ปีที่แล้ว +2

    Always love your videos but the examples are a bit confusing. I think some people might be lost…
    Just an honest feedback! Keep the good work! 👍🏼

    • @developedbyed
      @developedbyed  ปีที่แล้ว

      Oh that’s alright! Which bit did you find confusing? 😊

    • @ServanFICHET
      @ServanFICHET ปีที่แล้ว +1

      @@developedbyed for example, the part on call stack, web APIs and event loop. I guess it is a bit difficult to understand for a beginner with the examples chosen and Excalidraw. (I know it is not easy to explain and understand visually)
      Also on the promise, at 18:52, I think you got confused because you called in the user object the attribute “user” instead of “name” and I would have continued in you example instead of fetching jsonplaceholder. For example, you could have created a promise which resolves if user name is “Blanka” but rejects if user name is “Ken” and then illustrates it in the .then.catch chain, and finally use the same example with async await…
      No offense, I am just providing my view but I might be too picky ;)

  • @APG9tvlivenews
    @APG9tvlivenews ปีที่แล้ว

    🎉

  • @anirudhcodes
    @anirudhcodes ปีที่แล้ว

    Yes please update the JS and React courses!! 🥹

  • @aadarshverma6913
    @aadarshverma6913 9 หลายเดือนก่อน

    theon gratjoy

  • @salotspread
    @salotspread 9 หลายเดือนก่อน

    putangina you described it the best very noice moite i subbed.

  • @Rashik25
    @Rashik25 ปีที่แล้ว

    😊 Awesome

  • @germantoenglish898
    @germantoenglish898 ปีที่แล้ว

    Don't forget about the Swedish and Norwegians 😉

  • @consoledoterror971
    @consoledoterror971 ปีที่แล้ว

    nice refreshing video after a long time. i would say you could have started with hoisting first.

  • @M11-y1s
    @M11-y1s ปีที่แล้ว

  • @dennisbelio6470
    @dennisbelio6470 ปีที่แล้ว

    👏👏👏