Skip to main content

One post tagged with "event loop"

View All Tags

· 4 min read
Sivabharathy

JavaScript is often described as single-threaded, non-blocking, asynchronous, and concurrent. While these terms can seem daunting, the underlying concepts are straightforward when you understand how the Event Loop, Call Stack, Microtask Queue, and Macrotask Queue work together. In this article, we’ll demystify these concepts with explanations and code examples.


The Call Stack

The Call Stack is where JavaScript keeps track of function execution. It operates on the "last in, first out" (LIFO) principle. When a function is called, it’s added to the top of the stack. Once the function finishes execution, it’s removed from the stack.