Code samples from the book demonstrating JavaScript internals, V8 optimizations, and language quirks.
- Chapter 1: How JavaScript Runs — Event loop, microtasks, and concurrency
- Chapter 2: Strings — UTF-16, Unicode handling, and V8 string optimizations
- Chapter 3: Numbers — IEEE 754 floating-point, SMI optimization, and numeric edge cases
- Chapter 4: Primitives and Type Coercion — Type coercion, boxing, symbols, and truthiness
- Chapter 5: Objects and Prototypes — Prototype chain, hidden classes, and property storage
- Chapter 6: Functions — Closures, this binding, optimization tiers, and generators
- Chapter 7: Errors — Error handling, stack traces, and serialization
- Chapter 8: The Event Loop — Microtasks, macrotasks, and async execution ordering
Most examples run with Node.js:
node ch01_hello.jsExamples using V8 intrinsics require the --allow-natives-syntax flag:
node --allow-natives-syntax ch03_smi_optimization.jsSome optimization examples benefit from additional flags:
node --allow-natives-syntax --trace-opt --trace-deopt ch06_optimization_tiers.js
node --allow-natives-syntax --trace-ic ch05_megamorphism.js