Code Safari

Chapter 136·Intermediate

The Event Loop: How Pages Stay Responsive

01 / 06

The core idea

One thread, coordinated by a loop.

JavaScript runs on a single main thread. The event loop is the mechanism that decides what that thread does next — running code, handling events, and rendering.

The Event Loop: How Pages Stay Responsive | Code Safari