Full stack development

Stage 1 · Lesson 7 of 8

The event loop

Web foundations: HTML, CSS and JavaScript

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

  • CoursePaid
    Grokking JavaScript Fundamentals

    Design Gurus · Beginner · $50

    Guided course on the language core if you want structure and quizzes

  • CourseFree
    The Odin Project

    The Odin Project · Beginner

    Free Foundations course: HTML, CSS and JavaScript built in your own editor

Practise

  • Real designs to rebuild, so layout and interactivity get proper practice

Keep handy

  • The reference for HTML, CSS, JavaScript and browser APIs

  • Quick syntax lookups for HTML, CSS and JavaScript while you build

Also worth your time

Mark this stage as not done?