What is the JavaScript event loop really all about - Java Brains

Поделиться
HTML-код
  • Опубликовано: 1 окт 2024

Комментарии • 189

  • @yogeshjoshi388
    @yogeshjoshi388 4 года назад +75

    Appreciate your effort you put to make videos. I Learned a lot from your videos over last 5 years. Many Thanks Kaushik :)

    • @Java.Brains
      @Java.Brains  4 года назад +10

      Thanks! Yes, it does take a lot of time to produce these kind of videos, but I am glad they help! :)

    • @Saketjsaket
      @Saketjsaket 4 года назад +1

      @@Java.Brains It really helped out many persons. I am also one of them. Following you since your jaxrs courses came out. Thanks a lot for your effort. Happy Independence day...

    • @bhatnagarcapital
      @bhatnagarcapital 3 года назад

      ​@@Java.Brains How do you do the animations ?

    • @GaganKumar-ib5sg
      @GaganKumar-ib5sg 3 года назад

      @@Java.Brains Didn't know ,this complex looking concept was so so easy.Thnxx a ton.

    • @haidersalah1416
      @haidersalah1416 Год назад

      Simply You can make a program that can make 1 million likes for you !

  • @rajatmishra9993
    @rajatmishra9993 4 года назад +51

    I wish I can like this video a million times.

    • @dailyfacts1099
      @dailyfacts1099 3 года назад +1

      If you click in even number of times it doesn't going to help
      😂

    • @asitpurohit_108
      @asitpurohit_108 2 года назад

      Can be done using phython

    • @gatoloco1873
      @gatoloco1873 2 года назад

      Your likes would get stuck in the event queue

  • @u_ziben
    @u_ziben 3 года назад +38

    This is the clearest explanation of JS's event queue, call stack and event loop I have ever seen on RUclips. I really appreciate the effort you put into making these videos simple and clear. Great work JB!

  • @nikhil1651998
    @nikhil1651998 3 года назад +17

    This tutorial taught Callback, Synchronous & Asynchronous and Event Loop in the most easiest way possible. Watched many long videos but only 8:26 seconds was enough!

  • @zillalsenmesrane1022
    @zillalsenmesrane1022 2 года назад +2

    You are a beast my friend , this is the really easiest way to understand event loop , thank you so much

  • @areyoukidding6274
    @areyoukidding6274 3 года назад +5

    "If you can't explain it simply, you don't understand it well enough" - Albert Einstein
    This suits you man.. what an explanation!!

  • @PerpetualLearner8934
    @PerpetualLearner8934 4 года назад +8

    This channel has quality written all over it. Online and offline put together, teachers like you are hard to find. All I can do is write a comment here to thank you. Keep up the good work! :)

  • @69k_gold
    @69k_gold Год назад +1

    Amazing explanation! But I always wonder how the V8 runtime knows when some API call has returned or setTimeout is done. Is there a separate listener thread whose whole purpose is to wait for asynchronous callbacks so it can add them to the event queue?

  • @vivekmishra5876
    @vivekmishra5876 4 года назад +6

    This guy made my Weekend.
    Thanks koushik

  • @farslan
    @farslan 3 года назад +3

    the chef is also a worker thread in this analogy, am I missing something? there is one waiter thread and chef thread?

  • @deadchannel-x2m
    @deadchannel-x2m 4 года назад +4

    Wow! I actually studied JS Event loop before. As you said, many tutorials and JS Conf Talks helped me understand the concept better.
    But to me, the amazing analogy that you used and your awesome explanation, was the simplest one so far.
    Thank you so much, man!

  • @sreid70
    @sreid70 4 года назад +3

    I think you have the best videos on Javascript period. You take basic concepts and turn them into advanced concepts, yet I still understand what you are saying. You are a great teacher. Well done. Your "Introduction to Javascript for Developers" series is my most favorite Javascript series on RUclips. Very well done. Permanent bookmark:-)

  • @33pranav
    @33pranav 4 года назад +4

    Sir, please post more videos on Nodejs series.

  • @dj_tika
    @dj_tika 2 года назад +2

    This video has been incredibly helpful to simplify understanding of how event loops and call back works in JavaScript

  • @stefanoforgiarini339
    @stefanoforgiarini339 3 года назад +1

    Thank you so much! This video is perfect. I've finally figured out what event loop Is!

  • @ravianand6351
    @ravianand6351 4 года назад +4

    Is it just a coincidence that when I was learning java and spring koushik was also into it, and I'm now learning javascript, he's also doing the same :)

    • @Java.Brains
      @Java.Brains  4 года назад +8

      Yup, definitely stalking your learning path. Too bad you caught me! :)

    • @ravianand6351
      @ravianand6351 4 года назад +3

      @@Java.Brains hah But seriously, you've helped me a lot, and many others ofcourse. I found out the java road map video to be very helpful. If you could bring a similar sort of video for javascript, it would be really helpful.

  • @BleedingCode
    @BleedingCode 4 года назад +1

    Great visual video easily explaining management of synchronous and asynchronous logic. Thanks

  • @devroy692
    @devroy692 3 года назад +2

    OMG. I never thought the eventloop could be so easy to teach. Awesome.

  • @natanminaev1501
    @natanminaev1501 3 года назад +1

    thans, man. an ellegant explanation!

  • @kratostheinevitable3932
    @kratostheinevitable3932 2 года назад +1

    amazing explanation. thanks.

  • @СергейКурилов-д2н
    @СергейКурилов-д2н 2 года назад +3

    For the first time I saw how someone was able to explain the event loop with some kind of analogy from real life, I think this is what a lot of people on RUclips lack, thank you very much for your efforts!

    • @kinstar
      @kinstar 2 года назад

      sometimes the best explanations need to be in human terms 😅

  • @bernard2735
    @bernard2735 4 года назад +2

    Great, simple, clearly explained. Thanks mate.

  • @Shree79124
    @Shree79124 3 месяца назад

    Thanks, sir. However, I still have a question. For example, in my restaurant, 100 customers arrive simultaneously and they all want to order food. As you mentioned, we only have 1 waiter (thread). In this scenario, all customers will shout out, complain, and might not return to my restaurant next time.

  • @sourabhsahu961
    @sourabhsahu961 4 года назад +1

    Really missed you Kausik please please make videos frequently , I always eagerly waiting for your video they are always best as compared to other RUclips videos

  • @Alex-rt7de
    @Alex-rt7de 4 года назад +1

    tons of one hour duration videos about event loop, beautiful presentations jokes and no concrete info, why there is not videos like this. short and clear

  • @HabiburRahman-xs9gb
    @HabiburRahman-xs9gb Год назад

    The only video, that taught me something on this topic..thank you very much

  • @adonisaseem
    @adonisaseem Год назад

    Is that "while isNotEmpty(eventQueue)" loop running in the same thread or some JS engine level separate dedicated thread whose job is only to keep checking the eventQueue?

  • @coolbuddy2405
    @coolbuddy2405 4 года назад +1

    Great Video! Appreciate your effort. Thanks, Koushik!

  • @ThePakChina
    @ThePakChina 2 года назад

    Following you since 2012 ... when i was start to learn JSP,Hibernate stuff. Thank bro

  • @YOUASHPAKMULANI
    @YOUASHPAKMULANI 4 года назад

    Hi Kaushik
    I could not find complete javascript course on Java brains website.
    I was looking to purchase it but its not there now.
    I wanted to purchase it because of two reasons
    1. I have purchased hundreds of courses around programming on several platforms, but your courses are at the top when it comes to quality.
    2. I wanted to purchase as a token of appreciation for all your hard work.
    Please guide where can I purchase complete javascript course.

  • @himanshitaneja1254
    @himanshitaneja1254 4 года назад +1

    Awesome as always!! Thanks Sir. Keep enlightening us. God bless you with good health and all the happiness in the world! :)

  • @supa1009
    @supa1009 3 года назад

    6:49 is there a typo?
    Shouldn't it be chef.handOver(order1, ... ) ?
    either way, great video! :))

  • @SumitKumar-co2pm
    @SumitKumar-co2pm 3 года назад +1

    The best analogy to explain event loop. Thanks a lot

  • @marimuthur9456
    @marimuthur9456 2 года назад

    Extraordinary you are really cool it's very useful to understand easily thank you so much 👌🏼👌🏼

  • @kanha4790
    @kanha4790 2 месяца назад

    Event loop is a loop that are checking calstack continuously. if call stack is empty it push event that are waiting in event queue into the call stack for exicution perpose.

  • @justthings4044
    @justthings4044 3 года назад

    sadly you didn't explain what the chef in your example is exactly and WHY Javascript is able to go one without waiting for the task to finish. you didn't mention the web api. a little bit disappointed

  • @vishvish24
    @vishvish24 2 года назад

    I have to get json api data get every 2 second and make chart as per the json data. What should I use to 2 second get refreshed data of json. And this will be 24*7.

  • @Aayush28jun
    @Aayush28jun Год назад

    Definitely cleared all my doubts , sooo mooth of a tutorial. Bang on Example. Thanks a lot !

  • @kkkk150984
    @kkkk150984 Год назад

    But still a doubt, the call backes which are kept in event queue are getting executed synchronously or they are executed by some thread?

  • @headach09
    @headach09 Год назад

    I have to pause the video and give the positive comment. It is brilliant. Thanks for your effort.

  • @lavanyamanivannan6547
    @lavanyamanivannan6547 2 года назад

    This is my first comment for a tech video, this was neat and clear . very good job! really appreciate your work.

  • @mr-moses-01
    @mr-moses-01 3 года назад

    I dont wanna swear but This was fucking awesome bro TY

  • @antoniopacheco6001
    @antoniopacheco6001 3 года назад

    hey guy, im from brazil and i really apreciate your work, congratulations

  • @azeez9273
    @azeez9273 Год назад

    Your approach to explained the concept of event loop was superb. Thank you.

  • @dinner4chiahao
    @dinner4chiahao 2 года назад

    Brilliant, simple explanation. Thank you!

  • @vamsiprasadkumili1237
    @vamsiprasadkumili1237 Год назад

    who is the chef in JS that the waiter handovers the task to? Like waiter is the single execution thread you mentioned and who is the chef refers to in JS

  • @deepakarya5310
    @deepakarya5310 2 года назад

    thank you very much i have watched many resource and got so confused...this cleared all my doubt

  • @shashwotbhattarai8731
    @shashwotbhattarai8731 Год назад

    i heard that the callback in the que get pushed to the stack, only after the stack is empty, but does a stack ever get empty?

  • @Varun2799
    @Varun2799 3 года назад

    If JS is single threaded, how can the waiter and chef work at the same time?
    Can someone clear this up. Thanks

  • @chandrahaslanka
    @chandrahaslanka 4 года назад +1

    Hi Kaushik, great content and explanation as always. Could you also please explain macrotasks and microtasks as well? I've gone through some documentation on the same, but as you mentioned, they seems to be more complicated explanations.

  • @uicornerwithJ
    @uicornerwithJ Год назад

    Why noone talks about micro and macro task?

  • @Alex-rt7de
    @Alex-rt7de 4 года назад

    am I right that callback functions should be as ligher as possible?

  • @ash2ucool
    @ash2ucool 2 года назад

    Just Wow!! This is the best way to learn event loop. Thank you so much

  • @srigowri_5345
    @srigowri_5345 2 года назад

    What will execute the chef's order aka callback function?

  • @chriscfedrizzi
    @chriscfedrizzi Год назад

    Thank you sir, awesome explanation!

  • @gatoloco1873
    @gatoloco1873 2 года назад

    This video probe that the explanation is a Art that just a few ones domain.

  • @reynaoldman9100
    @reynaoldman9100 3 года назад +1

    This is the best explanation of the event queue and loop. I learned a lot from your videos. Thanks for putting together these great videos 🙏🏻

  • @ozgursulum4116
    @ozgursulum4116 2 года назад

    Thank you for simple explanation it saved a lot of time for me.

  • @hannahadams3507
    @hannahadams3507 2 года назад

    a million thank you's for such a perfect explanation man

  • @sadikuzzamanshovon7598
    @sadikuzzamanshovon7598 2 года назад

    Most Clear explanation. Learned a lot from this video.

  • @bhatnagarcapital
    @bhatnagarcapital 3 года назад

    @Java Brains How do you do the animations ?

  • @ankurchunekar1824
    @ankurchunekar1824 3 года назад

    Thankyou for this video, it is very helpful. 💯

  • @maheshsale
    @maheshsale 2 месяца назад

    This one is the best explanation I have ever seen. Thank you.

  • @Alex-rt7de
    @Alex-rt7de 4 года назад

    so event loop and callstack are the same things right?

  • @Omar-hw7zi
    @Omar-hw7zi 3 года назад

    Amazing analogy.. straightforward!!!

  • @jitendraasole5827
    @jitendraasole5827 Год назад

    And that was the best video who explained the Event Loop

  • @ManuDeepGodara-alpha
    @ManuDeepGodara-alpha 4 года назад +1

    If main thread is occupied with heavy calculative task, then who's putting button click events in event queue?

    • @Java.Brains
      @Java.Brains  4 года назад +4

      Remember - it's a single application thread. Other runtime concerns like queuing events, call stacks, memory management etc is managed by the runtime and does not involve the application thread.

    • @sumit919
      @sumit919 4 года назад

      @@Java.Brains i think this reply explains all the doubts i had regarding event loops. Thank you and god bless you for your tutorials :)

  • @mr.somebody646
    @mr.somebody646 2 года назад

    Amazing.... man I was really confused with this concept bt u know what this video completely cleared my doubt queue :)

  • @nandlalushir252
    @nandlalushir252 3 года назад

    Thanks for such informative video..

  • @rajatmishra9993
    @rajatmishra9993 4 года назад +1

    Please make videos on socket.io in node js.

    • @BleedingCode
      @BleedingCode 4 года назад +1

      Agreed. I feel like socket.io doesn't get the attention it deserves. I usually struggle to find dynamic and diverse content on its use in production environments. Sadly the last release of socket.io on NPM was a year ago, so that doesn't help things :(.

  • @ashutoshsahu5345
    @ashutoshsahu5345 3 года назад

    Thanks alot sir ♥️ best video on this topic on yt

  • @veerenderreddychama3190
    @veerenderreddychama3190 4 года назад +1

    I really liked “the waiter - restaurant” analogy to explain the event loop concept. Thanks!

  • @geraldtivatyi2116
    @geraldtivatyi2116 2 года назад

    I cannot thank you enough for this explanation

  • @virgilho4635
    @virgilho4635 2 года назад

    I love the animation as well as the poor waiter.😍

  • @jefe_t11
    @jefe_t11 Год назад

    What an amazing video. Great analogy and perfect delivery of explanation. Beauty!

  • @Kloster18
    @Kloster18 3 года назад

    i loved this video, i finally understand!!

  • @elvissanchez2703
    @elvissanchez2703 3 года назад

    I like the drawings you do.

  • @molekuax8646
    @molekuax8646 3 года назад

    I gave you 2 likes, thanks!

  • @Fido1hn
    @Fido1hn 6 месяцев назад

    Thank you this was a great video

  • @balajiganesh4246
    @balajiganesh4246 2 года назад

    Thank you legend 🙏🏼🙏🏼❤️❤️

  • @maiaklimenko6614
    @maiaklimenko6614 2 года назад

    Fantastic explanation, many thanks)

  • @441_soumyagarai3
    @441_soumyagarai3 2 года назад

    wowowowow!! thanks for making this vdo

  • @glauberbispocruzcarvalho2235
    @glauberbispocruzcarvalho2235 3 года назад

    thanks dude that was a great explanation

  • @wanekaxa1483
    @wanekaxa1483 Год назад

    Thank you so much for making this video, I'm grateful for the fact that the quantity of event loop tutorial videos on RUclips didn't stop you from making this video.

  • @omkarpatil470
    @omkarpatil470 2 года назад

    Totally loved the way you explained Event Loop. Straight away subscribing :D

  • @theteamleader7678
    @theteamleader7678 2 года назад

    This is a Master piece of explanation

  • @vipinsharma-zx9cb
    @vipinsharma-zx9cb 3 года назад

    Hi Sir, Just to clarify.. suppose I have three functions in a js file. Will all three of them will be placed in event queue? If no, then how come setimeout places the function in event queue?

  • @rajadastidar3765
    @rajadastidar3765 3 года назад

    Very nice and understandable tutorial

  • @leesanissi2394
    @leesanissi2394 Год назад

    very very very .....................................nice

  • @srinivasmudda8081
    @srinivasmudda8081 4 года назад

    Koushik you are awesome ..The Best on youtube ..thank you and apreciate a lot for such amazing detailed conceptual videos..COULD YOU PLEASE DO A SERIES ON DATA STRUCTURES BOTH CONCEPTS AND IMPLEMENTATION IN JAVASCRIPT ..would be very grateful..Ty

  • @nagaveer3315
    @nagaveer3315 8 месяцев назад

    Great explanation 🎉, thanks ✅

  • @js-love
    @js-love 4 года назад

    Your explain in simplest form pls make more video on JavaScript ES6 and Callback .. appreciate your efforts

  • @parvezmd6455
    @parvezmd6455 3 года назад

    Hi kousik, addEventListener() is asynchronous,but you mention it as synchronous ?

  • @jacobthedev4979
    @jacobthedev4979 2 года назад

    Wonderful video, simple and straight forward. The best way to acquire new knowledge!

  • @developertools95
    @developertools95 11 месяцев назад

    ooh bro u deserve more and more

  • @zdacad
    @zdacad 2 года назад

    You have just explained this topic in 5 mins. Salute for you.... Lots of love and respect

  • @xyz_only_10x
    @xyz_only_10x 2 года назад

    most underrated coding channel

  • @abhishekverma5928
    @abhishekverma5928 4 года назад

    Great fan of your video. Learn almost everything productive from your channel.please also make video on kubernates and docker.

  • @MattiaRuberto
    @MattiaRuberto Год назад

    thank you! now is clear

  • @daryllmamaril4225
    @daryllmamaril4225 2 года назад

    Brilliant and clear explanation! Thanks for making this video!