Event Loop
Event Loop
Section titled “Event Loop”Introduction
Section titled “Introduction”The event loop is the mechanism that allows JavaScript to perform non-blocking operations despite being single-threaded.
Topics Covered
Section titled “Topics Covered”- How It Works — Call stack, Web APIs, and queues
- Execution Order — What runs when and why
Learning Objectives
Section titled “Learning Objectives”- Understand the event loop’s role in JavaScript
- Know the order of execution for sync and async code
- Understand microtasks vs macrotasks priority
Summary
Section titled “Summary”Event loop enables async concurrency in single-threaded JS. Microtasks run before macrotasks. The event loop pauses when the call stack is not empty.