thecodex.expert · The Codex Family of Knowledge
Track 3 — Advanced

JavaScript: Advanced

Five lessons that take you to expert-level JavaScript — closures, generators, Proxy, and TypeScript.

🕐 ~7 hours5 lessonsES2024

Lessons

Lesson 1

Closures and the event loop in depth

How closures capture variables, the call stack, microtasks vs macrotasks, and why the event loop order matters.

Prerequisite: Practitioner track complete

What to look for:

  • The Exploring tab — closures and the IIFE module pattern
  • The Deep Dive tab — execution context and the call stack
  • Return to async page: microtask vs macrotask queue with the output order example
  • WeakRef and FinalizationRegistry — why closures can cause memory leaks
🕑 60 min
Lesson 2

Prototype chain and class internals

What typeof Animal returns, where methods live, Object.getPrototypeOf(), and how private fields actually work.

Prerequisite: Lesson 1 of Advanced

What to look for:

  • The Exploring tab — class internals section
  • Object.getPrototypeOf() chain trace to null
  • WeakMap for private state pattern
  • Symbol.iterator — making a custom class work with for...of and spread
🕑 60 min
Lesson 3

Iterators, generators, and Symbol

The iterator protocol (__iter__/__next__ equivalent), generator functions with yield, and well-known Symbols.

Prerequisite: Lesson 2 of Advanced

What to look for:

  • MDN: Generator function — generators are like Python generators
  • Symbol.iterator makes objects iterable
  • Symbol.toPrimitive controls type coercion
  • Async generators — yield inside async function
🕑 60 min
Lesson 4

Proxy and Reflect

Intercepting object operations with traps (get, set, has), Reflect as the default behaviour, and real-world uses.

Prerequisite: Lessons 1–3 of Advanced

What to look for:

  • Deep Dive tab — Proxy and Reflect section
  • get trap for lazy loading and access logging
  • set trap for validation
  • How Vue 3 uses Proxy for reactivity
🕑 45 min
Lesson 5

TypeScript introduction

How TypeScript adds a type system on top of JavaScript — interfaces, type inference, generics, and structural typing.

Prerequisite: Lessons 1–4 of Advanced

What to look for:

  • The TypeScript reference page — Curious tab first
  • Structural typing — different from Java/C# nominal typing
  • Type inference — you don't need to annotate everything
  • strict mode — NOT on by default, always enable it
🕑 60 min

How to use this track: Each lesson links to the relevant Codex reference page. Use the reading level tabs (Curious / Exploring / Deep Dive). The "what to look for" bullets guide your focus. Come back for the quiz when ready.

Track quiz

Four questions to check your understanding of the Advanced track.

What does a generator function return when called?

How do you make a custom class iterable with for...of?

What is the Proxy get trap used for?

TypeScript uses structural typing. What does that mean?