Skip to content
New this month 24 fresh C++, C#, F#, JavaScript, TypeScript and Lua courses just landed. Browse new releases Use code WELCOME10 for 10% off your first order · 14-day refund
Web Development Intermediate

JavaScript Intermediate: Closures, Promises and the Event Loop

Understand what the engine is doing so async bugs stop feeling like random chance.

Rated 5.0 out of 5 from 1 review 17 students

MH Created by Marcus Hale

  • Last updated August 2026
  • English
  • 6h 44m of material
  • 51 lessons

What you will learn

8 concrete outcomes

Every bullet below is something you will have built, shipped or be able to explain by the time you finish the last lesson.

  • Explain closures precisely, including the loop-variable trap and how to avoid it
  • Predict execution order across the call stack, task queue and microtask queue
  • Compose promises with all, allSettled, race and any for the right situations
  • Cancel in-flight work correctly using AbortController and cleanup patterns
  • Propagate and handle errors through async functions without swallowing them
  • Use generators and async iterators to process streams and paginated APIs
  • Apply debouncing, throttling and memoisation with a clear understanding of each
  • Measure long tasks and keep the main thread responsive under real load

Course curriculum

6 modules · 51 lessons · 6h 44m of material

10 lessons running 1h 18m in total. Each lesson ships with the finished source files and a short written recap, so you can follow along in your own editor and skim the module again later.

Lesson-by-lesson titles, code downloads and exercises live inside the course library you get access to straight after checkout.

9 lessons running 1h 14m in total. Each lesson ships with the finished source files and a short written recap, so you can follow along in your own editor and skim the module again later.

Lesson-by-lesson titles, code downloads and exercises live inside the course library you get access to straight after checkout.

10 lessons running 1h 20m in total. Each lesson ships with the finished source files and a short written recap, so you can follow along in your own editor and skim the module again later.

Lesson-by-lesson titles, code downloads and exercises live inside the course library you get access to straight after checkout.

7 lessons running 54m in total. Each lesson ships with the finished source files and a short written recap, so you can follow along in your own editor and skim the module again later.

Lesson-by-lesson titles, code downloads and exercises live inside the course library you get access to straight after checkout.

8 lessons running 1h 04m in total. Each lesson ships with the finished source files and a short written recap, so you can follow along in your own editor and skim the module again later.

Lesson-by-lesson titles, code downloads and exercises live inside the course library you get access to straight after checkout.

7 lessons running 54m in total. Each lesson ships with the finished source files and a short written recap, so you can follow along in your own editor and skim the module again later.

Lesson-by-lesson titles, code downloads and exercises live inside the course library you get access to straight after checkout.

6 modules · 51 lessons

6h 44m total length

Requirements

Short list, and deliberately so. If you meet these you can start today.

  • Comfortable writing JavaScript functions, arrays, objects and basic fetch calls
  • Node 20 or newer and a browser with developer tools
  • Experience with at least one project where async behaviour surprised you

About this course

There is a specific stage in learning JavaScript where the syntax is comfortable but the behaviour is not. A callback captures the wrong variable. A loop of awaits takes ten seconds instead of one. Something logs in an order that makes no sense. Every one of those has the same cause: an incomplete model of scope and the event loop. This course builds the correct one.

Closures are covered until they are boring, with memory diagrams, the classic loop-variable trap, module and factory patterns, and practical uses such as memoisation, debouncing and private state. Then comes the runtime: the call stack, the task queue, the microtask queue, and why a promise callback always runs before a timeout of zero. You will predict the output of increasingly nasty snippets and be right.

The applied half covers promise composition with all, allSettled, race and any, cancellation with AbortController, error propagation through async functions, generators and async iterators, and streaming a large response without loading it into memory. It closes with performance work: measuring long tasks, breaking them up, and keeping interaction responsive under load.

Frequently asked questions

Still unsure about something? Write to misteryjj100@gmail.com and a human answers, usually the same working day.

No. The event loop material covers both browser and Node semantics, including the differences around microtask timing and the Node-specific phases.

None is used. Everything runs in plain modules so the behaviour you observe is the engine, not a framework scheduler.

The beginner path teaches you to write working JavaScript. This one explains why it works, which is what you need when something breaks under concurrency.

Checkout is handled on our provider's secure payment page. The moment your payment clears we email your personal access link and access code to the address you used at checkout, and the same link appears in your account library. There is nothing to install and nothing to wait for.

Email misteryjj100@gmail.com within 14 days of your purchase, quote your order number, and we refund the full amount to your original payment method. No form to fill in and no questions about how much of the course you watched.

What students say

Reviews are written by people who bought this course. We publish the critical ones too.

5.0

Rated 5.0 out of 5

Course rating · 1 review

Rating distribution

  • 5 stars 100%
  • 4 stars 0%
  • 3 stars 0%
  • 2 stars 0%
  • 1 star 0%
  • JB

    Jean-Luc Baptiste

    Frontend engineer

    Feb 2026
    Rated 5.0 out of 5

    Microtasks versus tasks, drawn out on screen

    The animation running the call stack, the microtask queue and the task queue side by side is the clearest account of the event loop I have come across, and it made an entire category of setTimeout bug obvious in retrospect. The AbortController chapter was a bonus I had not expected.

Your instructor

MH

Marcus Hale

Web engineer and JavaScript educator

  • 259 students taught
  • 12 courses published
  • 4.7 instructor rating
  • JavaScript
  • TypeScript
  • React
  • Node.js

Marcus has shipped front ends for two ad-tech startups and one very large retailer, which taught him more about performance budgets than any blog post could. He teaches JavaScript and TypeScript from the runtime up — event loop first, framework second — then follows the same code through Node on the server side. Every one of his courses ends with a deployed application rather than a folder of exercises. He writes a weekly newsletter on browser performance.

$47 USD

One-time payment · lifetime access

The WisdomCharms dispatch

One useful email a week. No fluff, no spam.

New course releases, discount codes before anyone else, and a short, practical breakdown of one technique — a prompt pattern, a C++ idiom, a TypeScript trick — that you can use the same day.

  • Subscriber-only launch pricing
  • Unsubscribe in one click
  • We never sell your address

By subscribing you agree to our Privacy Policy. Questions? Write to misteryjj100@gmail.com.