A blog series
JavaScript Core Mastery
A lesson-by-lesson deep dive into how JavaScript actually runs under the hood — execution context, call stack, scope, closures, this, and the event loop. Pure execution-model JavaScript: no array methods, no framework code.
- Started
- 2026
- Progress
- 14 / 14 lessons
Contents
Lessons build on each other. If you are new, start at Lesson 01.
- Lesson 01How JS Works: The Execution ContextEverything in JavaScript happens inside an execution context. How the global one is created — memory phase first, then code phase — and why that order explains almost everything that follows.12 min
- Lesson 02The Call StackJavaScript can only ever do one thing at a time. This is the structure that decides exactly what runs right now, what's paused and waiting its turn, and what happens the moment a function calls itself one time too many.12 min
- Lesson 03Var, Let, and ConstAll three get hoisted. What happens after that — what value they start with, where they're actually stored in memory, and when you're allowed to touch them — is where they completely part ways.12 min
- Lesson 04Functions and Variable EnvironmentsEvery function call gets its own private notepad of variables — even the same function, called twice, never shares a page. This lesson is about exactly what goes in that notepad, who's allowed to read it, and when it gets thrown away.10 min
- Lesson 05Window and Global ThisEven a completely empty JS file isn't really empty — the engine still builds a global object and points a keyword called this straight at it. Here's exactly what gets built, what it's called in different places, and the one rule that quietly changes depending on strict mode.9 min
- Lesson 06Undefined vs Not DefinedThese sound like the same complaint — "there's nothing there" — but JavaScript treats them as two completely different situations, one safe and expected, the other a genuine error. Mixing them up is one of the most common small misunderstandings in the language.9 min
- Lesson 07Scope Chain and Lexical EnvironmentLesson 4 showed one function looking outward to Global. This lesson extends that into a full chain — as many levels deep as your code is nested — and gives it a proper name: lexical scope, decided entirely by where you physically wrote your code, never by which function called which.11 min
- Lesson 08let, const, var and the Temporal Dead ZoneThe full picture of the three declaration keywords: every axis they differ on, function scope versus block scope (and what loops do), exactly where the TDZ starts and ends and why it is temporal rather than positional, the places it hides, redeclaration, errors that stop your file before it runs, and the one exception to "typeof is always safe".18 min
- Lesson 09Block Scope and ShadowingA block is anything inside { }. Simple idea — but var and let react to that boundary in completely different, and sometimes dangerous, ways. What a block creates in memory, how nested blocks chain, and every shadowing rule — legal, illegal, and the function-boundary exception.14 min
- Lesson 10ClosuresA function that remembers where it was born — even after the place it was born in is gone. This is the one exception to "popped execution context = memory freed" that Lesson 2 promised we'd come back to.13 min
- Lesson 11setTimeout and Closures: The Interview ClassicOne loop, one setTimeout, one wrong answer almost everyone gives the first time. This lesson is dedicated entirely to the single most-asked closures question in JavaScript interviews — and four different, genuinely correct ways to fix it.12 min
- Lesson 12First-Class Functions, Callbacks and Event ListenersFunctions as values: passing them as arguments, returning them from other functions, sync vs async callbacks stepped side by side, and attaching and removing event listeners without leaking memory.14 min
- Lesson 13JS Engine and V8 ArchitectureParser, interpreter (Ignition), compiler (TurboFan), memory heap and garbage collection — what the engine does between your file and the CPU. Watch a function climb V8's tiers and fall back on a deopt, and step through mark-and-sweep.16 min
- Lesson 14Async JS and the Event LoopCall stack, Web APIs, callback queue, microtask queue and the event loop that ties them together, stepped tick by tick — plus async/await, where rendering fits, starvation, and why setTimeout(0) is not 0.20 min
Glossary
Every short form used in the series — GEC, TDZ, V8 and the rest. Inside any lesson, hover or tap a dotted term to see its meaning without leaving the page. Browse all terms →
Background reading
Standalone pieces that sit beside the lessons. Read them whenever they come up.