The "Event Loop" is the secret behind JavaScript's asynchronous programming. JS executes all operations on a single thread, but using few smart data structures, it gives us the illusion of multi-threading. In this tutorial, I have tried to explain what the Event Loop actually is, how it works and an illustration of Event Loop. While doing so, I introduced Call Stack, Render Queue, Microtasks Queue etc. In this video, I will take you through 4 code examples and will show how Event Loop takes care of them differently.
Please note that, this video has two prerequisites - 1) Execution Context 2) Asynchronous JavaScript. I have provided two detailed tutorials on these 2 topics. If you haven't seen those tutorials, I would request you to kindly watch those 2 videos first and then come back & watch this video.
▬ Contents of this video ▬▬▬▬▬▬▬▬▬▬
0:00 - Intro
1:49 - Synchronous Code
6:20 - Asynchronous timer
20:35 - Synchronous blocking code
27:03 - Promise
32:12 - Event Loop Implementation
References:
👉 JavaScript Execution Context - https://www.youtube.com/watch?v=Wk0-6b1W_VQ
👉 Asynchronous JavaScript - callbacks, promises & async-await - https://www.youtube.com/watch?v=IUBd76UQb34
#event_loop #javascript #bangla_programming_tutorial