Three strategies for the JavaScript event loop - Brain Bytes [Java Brains]

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

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

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

    "The callback function gets put to the back of event queue". That's so refreshing!

  • @sandeepsundaram5577
    @sandeepsundaram5577 4 года назад +5

    Happy Teachers Day !! One of the best teacher's !!!

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

    Best and the most hidden topic using JavaScript. Great Content

  • @MustafaAli-xj6lq
    @MustafaAli-xj6lq 2 года назад

    Best and most simple video so far

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

    Great as usual.I learned a lot of java concept from you now I am learning Javascript advanced staff from you.I am grateful.

  • @4t196
    @4t196 2 года назад

    You explaine very well...

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

    There are so many famous tutorials out there that teach wrong things.
    Your tutorials are the real thing ♥️.
    Please create a complete Javascript course.

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

    Happy Teacher's Day Koushik !!. Thanks for your Amazing Content.

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

    Great teacher always simplyfies the explanation like you

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

    As usual you are great in explaining complex things in simple way...

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

    I really like your didactic approach.

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

    Man this is gold!

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

    Really Awesome, i always recommend ur channel to other people.

  • @CVenture
    @CVenture 4 года назад +24

    Great .. Can you pls explain the differences between async await, promise and call backs? It confuses all the time..

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

      If we call a function inside another function then it is call called back.
      Promises are used to handle call back hells they have 2 parameters resolve, reject. To handle resolve we need to use .then to handle reject we need to use .catch
      To handle the promise chaining we will use async/await
      We need to use these async/await jointly
      for example
      async function test(){
      let data1=await func1();
      let data2=await func2();
      }
      async > promise > callback
      I hope you got some idea now

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

      @@ranikontham5573 Thanks for replying after 2 years tho. Appreciate your effort.

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

      @@CVenture Do you understand it now? lol

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

    So well-explained! Thank you!

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

    Awesome!!! Thanks.

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

    Really liked the introduction to web workers. Quality content as always 🙏

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

    great examples; I learned a lot. Thx!

  • @FahadKhan-qj3ej
    @FahadKhan-qj3ej 2 года назад

    Thank you so much.

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

    Thank you Koushik for this great content

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

    It's Great!!! Thanks a lot . You are amazing...

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

    9:26 when you explain strategy 2
    function processArray(bigArray, start)
    I think it will only execute once, because right after the forloop, start get increased by BATCH_SIZE while BATCH_SIZE remain the same the whole time

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

      He told that there is a bug in the code, the condition should have been "i < start + BATCH_SIZE" instead of "i < BATCH_SIZE"

    • @vivekkoul4428
      @vivekkoul4428 9 месяцев назад

      How it will be start + batch size? Batch size is the size of the array and loop can't exceed batch size.

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

    Thank you so much for such informative video 😊.. Please make playlist of Data structure and Algorithms using Javascript will feel more thankful. Because there is no such playlist to learn Algorithm using Javascript.Thank you 😊

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

    great!

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

    Please create tutorials for Docker and Kubernates, this topic is widely used and new !

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

    setTimeout(fn, 0) and setNextTick are effectively same right, appendig the function to end of pending function callback queue 🤔. Although for anyone reading there is a setImmediate 😐 which actually happens to place the function call for the next tick and not the end if event loop. 😌 Small nuances of nodejs api

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

    Great explanation, but I have some doubts: In strategy 1, why can't we just call the lessimportantWork() after the moreImportantWork()? why to use setTimeout altogether?

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

      hmm....good question AMC

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

      Js works in a loop. A good candidate would be user interaction and screen update functions. Not terribly important but needs to be small, quick and out of the way when* needed.
      Let’s say you’re updating a cart to a busy server, not an intensive process but can be slow. You still need to interact with the user and that all happens in the event loop.
      * when the loop magic allows time for them

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

    Use case one. just reorder function call .no need for settineout

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

    Can you please tell us what software you are using to edit video.

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

    why do we not just move the lessImportantFunction after the moreImportantFunction? Feels like that would be more of an intuitive way that doing the setTimeout(fn,0)?

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

    Hi Koushik, can web workers communicate amongst themselves? webWorker1 and webWorker2 for example

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

    So at the end is Nodejs a similar Java runtime ? since web workers were lunched ? at the end the difference between Java ecosystem and Javascript is only the fact that JS is a loosly typed, flexible language ?! It seems like there is a mimication or recreation or lets say highjacking of the Java ecosystem and a community revolution against Oracle passed supremacy, a community revolution supported by Google through v8 engin... ? is it right ?

    • @vivekkoul4428
      @vivekkoul4428 9 месяцев назад

      Is event loop concept also in javascript?

  • @AnandKumar-ro1yd
    @AnandKumar-ro1yd 4 года назад

    Sir, have you created multithreading and concurrency tutorial? Please create tutorial in this. These concepts are hard to understand

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

    Hello Sir, Please make one series on Nashorn JavaScript. The amount of contents on internet are very very less. Please address this. Thank You..!!

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

    I always used setTimeout with 0ms as the time, but only now do I properly understand what it's actually doing

  • @vivekkoul4428
    @vivekkoul4428 9 месяцев назад

    Can anybody tell me pls what is the bug in the 2nd method?