Finally, I understand JS flow of execution !!! I have already watched many youtube tutorials on this complex topic but for the first time I understand, how all things happen under the hood !!! Only because of your Lecture !!! awesome work Regard: Imran from Pakistan
If you put "1000" to a setTimeout, when is the countdown actually starting? When setTimeout hits the callback queue, or after all synchronous code gets executed?
Web APIs hits callback queue when it's done it's work. Set timeout calls Timer API, timer API starts counting. It finishes counting. It says it finished counting to callback queue and it's placed there. If there is other API waiting to be executed , it is placed behind. Literally a queue. Event loop looks for free global execution context and if it finds it to be free, it pushes first callback function on execution context. Rest is JavaScript on the roll. Rinse and repeat.
@@AB-cn5hb So to make sure I'm understanding this, essentially the countdown starts when setTimeout calls Timer API, and then Timer API starts the countdown?
Video starts as 20:06
Such an amazing comment. Thanks boss.
20 minutes of waffle and advertising
Finally, I understand JS flow of execution !!! I have already watched many youtube tutorials on this complex topic but for the first time I understand, how all things happen under the hood !!!
Only because of your Lecture !!! awesome work Regard: Imran from Pakistan
Knowledge + pedagogy = easy learning. Thank you.
I've been struggling with async JS for ages, but watching this video has helped so much. Thanks for the great explanations Sam!
This was my life saver today, thank you so much Samantha!
Thanks Ashley - Sam will really appreciate this
I can’t wait to enroll in Codesmith!
Great video! Thanks so much! :-) It definitely helped me!
Thanks for sharing this!
As always, excellent job done!
If you put "1000" to a setTimeout, when is the countdown actually starting? When setTimeout hits the callback queue, or after all synchronous code gets executed?
Web APIs hits callback queue when it's done it's work. Set timeout calls Timer API, timer API starts counting. It finishes counting. It says it finished counting to callback queue and it's placed there. If there is other API waiting to be executed , it is placed behind. Literally a queue. Event loop looks for free global execution context and if it finds it to be free, it pushes first callback function on execution context. Rest is JavaScript on the roll. Rinse and repeat.
@@AB-cn5hb So to make sure I'm understanding this, essentially the countdown starts when setTimeout calls Timer API, and then Timer API starts the countdown?
38
Helpful video, though I recommend running at 1.25 speed
oh man that guy's last question is terrible, shouldn't have been included in the video