liveBook · Manning

What you will learn in Secrets of the JavaScript Ninja, Third Edition

by Trevor Burnham, Bear Bibeault, Josip Maras, John Resig · Manning Early Access Program (MEAP)

Chapter by chapter

Chapter 1: JavaScript is everywhere

The introduction explains how JavaScript evolved from a browser scripting language into a versatile language with better performance and development tools.

1.1 Understanding the JavaScript language · 1.1.1 JavaScript runtimes and engines · 1.1.2 How does JavaScript get new features? · 1.1.3 Transpilers and polyfills give us access to tomorrow’s JavaScript today · 1.2 Navigating the world of frameworks · 1.2.1 Web UI frameworks · 1.2.2 Server frameworks · 1.2.3 App frameworks · 1.3 Using current best practices · 1.3.1 Type checking · 1.3.2 Linting and formatting · 1.3.3 Testing · 1.4 Challenges facing JavaScript Ninjas · 1.4.1 Performance · 1.4.2 Collaboration at scale · 1.4.3 Dependency management · 1.5 Summary

What you learn in chapter 1 →

Chapter 2: Using modern JavaScript tools

The chapter introduction explains how modern tools added guardrails to JavaScript development and why Node.js is used to run those tools.

2.1 Type checking with TypeScript · 2.1.1 Installing and running the TypeScript compiler · 2.1.2 Type annotations and declarations · 2.1.3 Type narrowing and predicates · 2.1.4 Running TypeScript without compilation · 2.2 Enforcing code rules with ESLint · 2.2.1 Setting up ESLint in a TypeScript project · 2.2.2 Disabling ESLint rules · 2.2.3 Enforcing a distinctive code style · 2.3 Automating formatting with Prettier · 2.3.1 Setting up Prettier · 2.3.2 Running Prettier from a commit hook · 2.4 Summary

What you learn in chapter 2 →

Chapter 3: Working with Node.js and npm

The introduction explains why JavaScript suited Node.js’s original server goal and why Node.js and npm matter beyond server applications.

3.1 The Node.js runtime · 3.1.1 Running the Node.js REPL · 3.1.2 Using Node.js APIs · 3.2 Managing Node.js dependencies · 3.2.1 Installing dependencies with npm · 3.2.2 Understanding node_modules · 3.2.3 Syncing and updating dependencies · 3.2.4 Forking and patching dependencies · 3.3 Scripting with Node.js · 3.3.1 Defining scripts in package.json · 3.3.2 Writing executable scripts with Node.js · 3.3.3 Running package executables with npx · 3.4 Summary

What you learn in chapter 3 →

Chapter 4: Building web applications

The introduction explains how JavaScript became central to web development and why developers still need to understand browser behavior.

4.1 The lifecycle overview · 4.2 The page-building phase · 4.2.1 Parsing HTML and building the DOM · 4.2.2 Executing JavaScript code · 4.3 Event handling · 4.3.1 Event-handling overview · 4.3.2 Registering event handlers · 4.4 Writing interactive HTML with JSX · 4.5 Summary

What you learn in chapter 4 →

Chapter 5: First-class functions for the novice: definitions and arguments

The chapter introduction explains why functions are central to JavaScript and introduces their status as first-class objects.

5.1 Defining functions · 5.1.1 Function declarations and function expressions · 5.1.2 Arrow functions · 5.2 The versatility of JavaScript functions · 5.2.1 Functions as first-class objects · 5.2.2 Callback functions · 5.3 Fun with functions · 5.3.1 Storing functions in a collection · 5.3.2 Attaching metadata to functions · 5.3.3 Memoizing functions · 5.4 Arguments and function parameters · 5.4.1 Rest parameters · 5.4.2 Default parameters · 5.5 Declaring functions in TypeScript · 5.5.1 Defining parameter types · 5.5.2 Defining return types in TypeScript · 5.5.3 Function overloading · 5.5.4 Documenting functions with TSDoc · 5.6 Summary

What you learn in chapter 5 →

Chapter 6: Functions for the journeyman: understanding function invocation

This chapter introduction establishes that `this` depends on how a function is called and explains why rest parameters have largely replaced the older `arguments` object.

6.1 The this parameter: introducing the function context · 6.2 Invoking functions · 6.2.1 Invocation as a standalone function · 6.2.2 Invocation as a method · 6.2.3 Invocation as a constructor · 6.2.4 Invocation with the apply and call methods · 6.3 Fixing the problem of function contexts · 6.3.1 Using the bind method · 6.3.2 Using arrow functions to get around function contexts · 6.4 Summary

What you learn in chapter 6 →

Chapter 7: Functions for the master: closures and scopes

The chapter introduction explains why closures matter and connects them to JavaScript scope without yet explaining their mechanics.

7.1 Understanding closures · 7.2 Putting closures to work · 7.2.1 Saving values in function-scoped variables · 7.2.2 Referencing surrounding variables from callbacks · 7.3 Variable scope and hoisting · 7.3.1 Creating block scopes · 7.3.2 Execution order and hoisting · 7.3.3 Parsing and scope analysis · 7.4 The global scope object · 7.5 Preventing memory leaks · 7.6 Summary

What you learn in chapter 7 →

Chapter 8: Functions for the future: promises and generators

The chapter introduces promises as a modern alternative to callbacks for dealing with future events and previews async/await and generators.

8.1 The power of promises · 8.1.1 Resolving and settling promises · 8.1.2 Chaining promises with then() · 8.1.3 Dealing with multiple promises · 8.1.4 Promise timing: Of microtasks and macrotasks · 8.2 Flattening promise callbacks with await · 8.2.1 The problem with nested callbacks · 8.2.2 How await works · 8.2.3 Automating promise creation with async · 8.3 Making interruptible loops with generators · 8.3.1 Iterables and iterators · 8.3.2 Iterating within a function with generators · 8.3.3 Async iterables and async generators · 8.4 Summary

What you learn in chapter 8 →

Chapter 9: Objects, prototypes, and classes

The introduction explains why JavaScript objects are more than key-value pairs and why prototypes still matter in an era of classes.

9.1 Customizing objects with properties · 9.1.1 Defining getters and setters · 9.1.2 Defining and redefining object properties · 9.2 Intercepting object access with Proxy and Reflect · 9.3 Dynamic inheritance with prototypes · 9.3.1 Fallbacks as inheritance · 9.3.2 Building prototyped objects with constructors · 9.4 Classic OOP with class and extends · 9.4.1 Classes as shorthand for prototypes · 9.4.2 Inheriting across classes · 9.4.3 Restricting access with private elements · 9.5 Summary

What you learn in chapter 9 →

Chapter 10: Dealing with collections

The chapter introduces JavaScript collections by distinguishing arrays, maps, and sets, then previews a discussion of immutability.

10.1 Arrays · 10.1.1 Creating arrays · 10.1.2 Adding and removing items at either end of an array · 10.1.3 Adding and removing items at any array location · 10.1.4 Common operations on arrays · 10.2 Maps · 10.2.1 Creating our first map · 10.2.2 Iterating over maps · 10.2.3 Weakly holding references with WeakMap · 10.3 Sets · 10.3.1 Creating our first set · 10.3.2 Combining and comparing sets · 10.3.3 Weakly holding references with WeakSet · 10.4 Mutable and immutable collections · 10.4.1 The perils of mutability · 10.4.2 Read-only collections in TypeScript · 10.4.3 Immutable transformations with Immer · 10.5 Summary

What you learn in chapter 10 →

Chapter 11: Buffers and streams

The chapter introduction explains why buffers and streams help JavaScript handle large data efficiently and notes that these APIs are available across modern runtimes.

11.1 Buffers and typed arrays · 11.1.1 Using buffers to receive data · 11.1.2 Accessing buffered bytes with typed arrays · 11.1.3 Flexible buffer manipulation with DataView · 11.2 Streaming and piping data · 11.2.1 Reading and writing streams · 11.2.2 Piping streams · 11.3 Controlling streams as a consumer · 11.3.1 Pull streams · 11.3.2 Controlling buffering with backpressure · 11.4 Summary

What you learn in chapter 11 →

Chapter 12: Wrangling regular expressions

The chapter introduction explains why regular expressions are useful for searching and parsing strings, while cautioning that some patterns call for a full parser instead.

12.1 Why regular expressions rock · 12.2 A regular expression refresher · 12.2.1 Regular expressions explained · 12.2.2 Terms and operators · 12.3 Compiling regular expressions · 12.4 Capturing matching segments · 12.4.1 Performing simple captures · 12.4.2 Repeated matching using global expressions · 12.4.3 Referencing captures within a regular expression · 12.5 String replacement with regexes · 12.6 Lookahead, lookbehind, and backtracking · 12.6.1 Sneaking a peek with lookahead · 12.6.2 Achieving hindsight with lookbehind · 12.6.3 Backtracking and regex performance · 12.7 Summary

What you learn in chapter 12 →

Chapter 13: Modules and bundlers

This introduction traces why JavaScript module formats emerged, how developers worked around their limitations, and why ESM is becoming the standard.

13.1 Understanding ESM · 13.1.1 Importing and exporting in ESM · 13.1.2 Resolving imports with entry points and maps · 13.2 Bridging ESM with CommonJS · 13.2.1 The double-default problem · 13.2.2 The top-level await problem · 13.3 Building JS bundles · 13.3.1 The art of code splitting · 13.3.2 Targeting browsers with transpilation · 13.4 Summary

What you learn in chapter 13 →

Concepts explained in this book

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.