Deep JavaScript: Theory and Techniques
414 pages
English
PDF
4.5

Deep JavaScript: Theory and Techniques

Deep JavaScript: Theory and Techniques

Author:

Year:

Summary:

Introduction

The book «Deep JavaScript: Theory and Techniques» by Axel Rauschmayer was published in 2020 and immediately took its place among the must-reads for those who want not just to write in JavaScript, but to truly understand its internal workings. The author is known for his blog «2ality» and the books «Speaking JavaScript» and «Exploring ES6», so deep immersion into the language was expected from the new work. And the expectations were met.

This book is not another syntax reference or a tutorial for beginners. It is an exploration of the fundamental mechanisms of JavaScript that often remain behind the scenes even for experienced developers. Rauschmayer systematically breaks down how the language works «under the hood», relying on the ECMAScript specification.

What is this book about?

The book consists of several logical blocks, each dedicated to a key concept of the language. The author doesn't just explain how to use a particular feature, but shows why it works that way, what trade-offs were made during its design, and how to avoid common mistakes.

Main topics covered in the book:

  • Data types and type coercion: An in-depth analysis of primitives and objects, the ToPrimitive, ToNumber, ToString mechanisms and their impact on everyday code.
  • Prototypal inheritance: A detailed explanation of prototype chains, the `__proto__` property, `Object.getPrototypeOf()`, creating hierarchies without classes (and with classes).
  • Closures and scope: How lexical environments work, the difference between var, let and const from the engine's perspective, practical patterns with closures.
  • this and execution context: A complete breakdown of all this binding rules (default, implicit, explicit, via new, arrow functions).
  • Asynchrony: Event Loop, microtasks and macrotasks, Promise (internal structure), async/await, error handling in asynchronous code.
  • Modules: ES modules vs CommonJS, static structure, tree shaking, circular dependencies.
  • Reflection and metaprogramming: Proxy, Reflect, Symbol, how to intercept basic object operations.

Who is this book for?

The book is aimed at intermediate and advanced developers who already write confidently in JavaScript but feel they lack a systematic understanding. If you know how `Array.prototype.map` works but don't fully understand how the engine processes a method call or what an «iterable object» is — this book is for you.

Beginners will likely find the book complex and overloaded with details. The author assumes the reader is familiar with basic syntax and can work with functions and objects. However, if you are just starting out and want to build a correct understanding from the ground up, you can read it alongside a basic textbook, but be prepared for a slow pace.

What will the reader learn?

After reading the book, you will be able to:

  • Explain the difference between `==` and `===` not as «strict vs non-strict», but through the Abstract Equality Comparison and Strict Equality Comparison algorithms.
  • Understand how inheritance works in JavaScript at the prototype level, and why `class` is syntactic sugar.
  • Write reliable functions with proper context management, avoiding the loss of `this`.
  • Build complex asynchronous chains, understanding the execution order of micro- and macrotasks.
  • Use Proxy and Reflect to create virtual objects, validation, and logging.
  • Navigate the ECMAScript specification and read it to answer complex questions.
  • Optimize code by knowing which operations are expensive and which are cheap from the engine's perspective.

Strengths of the book

The first thing that stands out is the depth of material coverage

Recommendations