DEV Community

Cover image for What is this "Event Loop" that they speak of in Javascript?
kapeel kokane
kapeel kokane

Posted on

What is this "Event Loop" that they speak of in Javascript?

👨🏾‍đŸ’ģI dug into the workings of the Javascript event loop and created this video which is one of the top 5 videos for that topic on YouTube (as per search results). Do give it a watch and let me know if you learned something new today. 🤟🏾

The context

When I started learning javascript, I thought that it was just a tool to add functionality to a static web site. The more I dug into the language, the more I found out there is to it. And there had to be. With the giants of the tech world like Netflix, Airbnb, Uber building several of their micro-services using Node, there had to be something special about this language.

And there was. The way in which javascript handles events is one of the core qualities that differentiate it from most of the other players out there. The event loop is that piece of the puzzle that enables the main javascript thread to run on a single thread, yet provide a smooth interface for async stuff like network, i/o, etc.

It is something that we as developers don't pay much attention to when we start learning a language, the syntax, the semantics but only start to wonder about a little while later when we have the basics figured out. Only when an "aha" moment occurs and you wonder "how did that code work (or not work, for that matter) when you start to deep dive and uncover secrets. Nevertheless, getting to know what you did not know until that moment progresses you on another level as a developer.

Hope that helped, Cheers!

Top comments (0)