Concept Flow - Event loop mental model
Start: Node.js program runs
Call Stack: Execute sync code
Encounter async task?
No→Continue sync
Yes
Register callback in Task Queue
Event Loop checks Call Stack empty?
No
Move callback from Task Queue to Call Stack
Execute callback
Repeat Event Loop
The event loop runs continuously, executing synchronous code first, then processing asynchronous callbacks from the task queue when the call stack is empty.