What is the Event Loop?
- The stack: The order in which your code is being executed, is handled by the call stack. You can think of it as an array that holds a list of command on what to execute next.
- The task queue: Everything that is waiting to be executed is stored in the task queue. Such as a callback funcion from a
setTimeout. Until the task queue is empty again, the event loop will process the next message in the queue and puts it into the stack.
Tired of looking for tutorials?
You are not alone. Webtips has more than 400 tutorials which would take roughly 75 hours to read.