Stage 1 · Lesson 7 of 8
The event loop
runs your code on a single thread, one step at a time. Yet it handles many timers, clicks and network calls at once. The makes that work.
Slow work is handed off to the browser or runtime. When it finishes, its waits in a queue and runs once the current code is done. Promise callbacks (microtasks) run before timer callbacks (macrotasks).
That is why a resolved promise logs before a setTimeout of 0. This matters even more on the server. In , one long loop blocks every other request until it ends.
Hashing a large file in plain JavaScript is an example. Knowing the event loop now makes Node.js and server performance much easier to reason about in later stages.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- CoursePaidGrokking JavaScript Fundamentals
Design Gurus · Beginner · $50
Guided course on the language core if you want structure and quizzes
- CourseFreeThe Odin Project
The Odin Project · Beginner
Free Foundations course: HTML, CSS and JavaScript built in your own editor
Practise
Keep handy
Also worth your time
The request path from browser to server that the rest of this roadmap builds on