Module 02

Browser events

JavaScript is single-threaded. Yet it powers complex SPAs, makes simultaneous API calls, and handles infinite scrolling without ever freezing. How? Let's meet the Event Loop.

Learning Contract

By the end of this module, you will understand exactly how JavaScript executes asynchronous code.

You will never guess the output of a setTimeout/Promise quiz again.

This module will explain:

  • How the Call Stack executes synchronous code
  • Why blocking the main thread destroys user experience
  • How Web APIs handle heavy lifting in the background
  • The fierce priority battle between Macrotasks and Microtasks
  • The exact algorithm of the Event Loop