1. Preface a. Conventions Used in This Book b. Example Code c. O’Reilly Online Learning d. How to Contact Us e. Acknowledgments 2. Introduction to JavaScript a. 1.1 Exploring JavaScript b. 1.2 Hello World c. 1.3 A Tour of JavaScript d. 1.4 Example: Character Frequency Histograms e. 1.5 Summary 3. Lexical Structure a. 2.1 The Text of a JavaScript Program b. 2.2 Comments c. 2.3 Literals d. 2.4 Identifiers and Reserved Words i. 2.4.1 Reserved Words e. 2.5 Unicode i. 2.5.1 Unicode Escape Sequences ii. 2.5.2 Unicode Normalization f. 2.6 Optional Semicolons g. 2.7 Summary 4. Types, Values, and Variables a. 3.1 Overview and Definitions b. 3.2 Numbers i. 3.2.1 Integer Literals ii. 3.2.2 Floating-Point Literals iii. 3.2.3 Arithmetic in JavaScript iv. 3.2.4 Binary Floating-Point and Rounding Errors v. 3.2.5 Arbitrary Precision Integers with BigInt vi. 3.2.6 Dates and Times c. 3.3 Text i. 3.3.1 String Literals ii. 3.3.2 Escape Sequences in String Literals iii. 3.3.3 Working with Strings iv. 3.3.4 Template Literals v. 3.3.5 Pattern Matching d. 3.4 Boolean Values e. 3.5 null and undefined f. 3.6 Symbols g. 3.7 The Global Object h. 3.8 Immutable Primitive Values and Mutable Object References i. 3.9 Type Conversions i. 3.9.1 Conversions and Equality ii. 3.9.2 Explicit Conversions iii. 3.9.3 Object to Primitive Conversions j. 3.10 Variable Declaration and Assignment i. 3.10.1 Declarations with let and const ii. 3.10.2 Variable Declarations with var iii. 3.10.3 Destructuring Assignment k. 3.11 Summary 5. Expressions and Operators a. 4.1 Primary Expressions b. 4.2 Object and Array Initializers c. 4.3 Function Definition Expressions d. 4.4 Property Access Expressions i. 4.4.1 Conditional Property Access e. 4.5 Invocation Expressions i. 4.5.1 Conditional Invocation f. 4.6 Object Creation Expressions g. 4.7 Operator Overview i. 4.7.1 Number of Operands ii. 4.7.2 Operand and Result Type iii. 4.7.3 Operator Side Effects iv. 4.7.4 Operator Precedence v. 4.7.5 Operator Associativity vi. 4.7.6 Order of Evaluation h. 4.8 Arithmetic Expressions i. 4.8.1 The + Operator ii. 4.8.2 Unary Arithmetic Operators iii. 4.8.3 Bitwise Operators i. 4.9 Relational Expressions i. 4.9.1 Equality and Inequality Operators ii. 4.9.2 Comparison Operators iii. 4.9.3 The in Operator iv. 4.9.4 The instanceof Operator j. 4.10 Logical Expressions i. 4.10.1 Logical AND (&&) ii. 4.10.2 Logical OR (||) iii. 4.10.3 Logical NOT (!) k. 4.11 Assignment Expressions i. 4.11.1 Assignment with Operation l. 4.12 Evaluation Expressions i. 4.12.1 eval() ii. 4.12.2 Global eval() iii. 4.12.3 Strict eval() m. 4.13 Miscellaneous Operators i. 4.13.1 The Conditional Operator (?:) ii. 4.13.2 First-Defined (??) iii. 4.13.3 The typeof Operator iv. 4.13.4 The delete Operator v. 4.13.5 The await Operator vi. 4.13.6 The void Operator vii. 4.13.7 The comma Operator (,) n. 4.14 Summary 6. Statements a. 5.1 Expression Statements b. 5.2 Compound and Empty Statements c. 5.3 Conditionals i. 5.3.1 if ii. 5.3.2 else if iii. 5.3.3 switch d. 5.4 Loops i. 5.4.1 while ii. 5.4.2 do/while iii. 5.4.3 for iv. 5.4.4 for/of v. 5.4.5 for/in e. 5.5 Jumps i. 5.5.1 Labeled Statements ii. 5.5.2 break iii. 5.5.3 continue iv. 5.5.4 return v. 5.5.5 yield vi. 5.5.6 throw vii. 5.5.7 try/catch/finally f. 5.6 Miscellaneous Statements i. 5.6.1 with ii. 5.6.2 debugger iii. 5.6.3 “use strict” g. 5.7 Declarations i. 5.7.1 const, let, and var ii. 5.7.2 function iii. 5.7.3 class iv. 5.7.4 import and export h. 5.8 Summary of JavaScript Statements 7. Objects a. 6.1 Introduction to Objects b. 6.2 Creating Objects i. 6.2.1 Object Literals ii. 6.2.2 Creating Objects with new iii. 6.2.3 Prototypes iv. 6.2.4 Object.create() c. 6.3 Querying and Setting Properties i. 6.3.1 Objects As Associative Arrays ii. 6.3.2 Inheritance iii. 6.3.3 Property Access Errors d. 6.4 Deleting Properties e. 6.5 Testing Properties f. 6.6 Enumerating Properties i. 6.6.1 Property Enumeration Order g. 6.7 Extending Objects h. 6.8 Serializing Objects i. 6.9 Object Methods i. 6.9.1 The toString() Method ii. 6.9.2 The toLocaleString() Method iii. 6.9.3 The valueOf() Method iv. 6.9.4 The toJSON() Method j. 6.10 Extended Object Literal Syntax i. 6.10.1 Shorthand Properties ii. 6.10.2 Computed Property Names iii. 6.10.3 Symbols as Property Names iv. 6.10.4 Spread Operator v. 6.10.5 Shorthand Methods vi. 6.10.6 Property Getters and Setters k. 6.11 Summary 8. Arrays a. 7.1 Creating Arrays i. 7.1.1 Array Literals ii. 7.1.2 The Spread Operator iii. 7.1.3 The Array() Constructor iv. 7.1.4 Array.of() v. 7.1.5 Array.from() b. 7.2 Reading and Writing Array Elements c. 7.3 Sparse Arrays d. 7.4 Array Length e. 7.5 Adding and Deleting Array Elements f. 7.6 Iterating Arrays g. 7.7 Multidimensional Arrays h. 7.8 Array Methods i. 7.8.1 Array Iterator Methods ii. 7.8.2 Flattening arrays with flat() and flatMap() iii. 7.8.3 Adding arrays with concat() iv. 7.8.4 Stacks and Queues with push(), pop(), shift(), and unshift() v. 7.8.5 Subarrays with slice(), splice(), fill(), and copyWithin() vi. 7.8.6 Array Searching and Sorting Methods vii. 7.8.7 Array to String Conversions viii. 7.8.8 Static Array Functions i. 7.9 Array-Like Objects j. 7.10 Strings as Arrays k. 7.11 Summary 9. Functions a. 8.1 Defining Functions i. 8.1.1 Function Declarations ii. 8.1.2 Function Expressions iii. 8.1.3 Arrow Functions iv. 8.1.4 Nested Functions b. 8.2 Invoking Functions i. 8.2.1 Function Invocation ii. 8.2.2 Method Invocation iii. 8.2.3 Constructor Invocation iv. 8.2.4 Indirect Invocation v. 8.2.5 Implicit Function Invocation c. 8.3 Function Arguments and Parameters i. 8.3.1 Optional Parameters and Defaults ii. 8.3.2 Rest Parameters and Variable-Length Argument Lists iii. 8.3.3 The Arguments Object iv. 8.3.4 The Spread Operator for Function Calls v. 8.3.5 Destructuring Function Arguments into Parameters vi. 8.3.6 Argument Types d. 8.4 Functions as Values i. 8.4.1 Defining Your Own Function Properties e. 8.5 Functions as Namespaces f. 8.6 Closures g. 8.7 Function Properties, Methods, and Constructor i. 8.7.1 The length Property ii. 8.7.2 The name Property iii. 8.7.3 The prototype Property iv. 8.7.4 The call() and apply() Methods v. 8.7.5 The bind() Method vi. 8.7.6 The toString() Method vii. 8.7.7 The Function() Constructor h. 8.8 Functional Programming i. 8.8.1 Processing Arrays with Functions ii. 8.8.2 Higher-Order Functions iii. 8.8.3 Partial Application of Functions iv. 8.8.4 Memoization i. 8.9 Summary 10. Classes a. 9.1 Classes and Prototypes b. 9.2 Classes and Constructors i. 9.2.1 Constructors, Class Identity, and instanceof ii. 9.2.2 The constructor Property c. 9.3 Classes with the class Keyword i. 9.3.1 Static Methods ii. 9.3.2 Getters, Setters, and other Method Forms iii. 9.3.3 Public, Private, and Static Fields iv. 9.3.4 Example: A Complex Number Class d. 9.4 Adding Methods to Existing Classes e. 9.5 Subclasses i. 9.5.1 Subclasses and Prototypes ii. 9.5.2 Subclasses with extends and super iii. 9.5.3 Delegation Instead of Inheritance iv. 9.5.4 Class Hierarchies and Abstract Classes f. 9.6 Summary 11. Modules a. 10.1 Modules with Classes, Objects, and Closures i. 10.1.1 Automating Closure-Based Modularity b. 10.2 Modules in Node i. 10.2.1 Node Exports ii. 10.2.2 Node Imports iii. 10.2.3 Node-Style Modules on the Web c. 10.3 Modules in ES6 i. 10.3.1 ES6 Exports ii. 10.3.2 ES6 Imports iii. 10.3.3 Imports and Exports with Renaming iv. 10.3.4 Re-Exports v. 10.3.5 JavaScript Modules on the Web vi. 10.3.6 Dynamic Imports with import() vii. 10.3.7 import.meta.url d. 10.4 Summary 12. The JavaScript Standard Library a. 11.1 Sets and Maps i. 11.1.1 The Set Class ii. 11.1.2 The Map Class iii. 11.1.3 WeakMap and WeakSet b. 11.2 Typed Arrays and Binary Data i. 11.2.1 Typed Array Types ii. 11.2.2 Creating Typed Arrays iii. 11.2.3 Using Typed Arrays iv. 11.2.4 Typed Array Methods and Properties v. 11.2.5 DataView and Endianness c. 11.3 Pattern Matching with Regular Expressions i. 11.3.1 Defining Regular Expressions ii. 11.3.2 String Methods for Pattern Matching iii. 11.3.3 The RegExp Class d. 11.4 Dates and Times i. 11.4.1 Timestamps ii. 11.4.2 Date Arithmetic iii. 11.4.3 Formatting and Parsing Date Strings e. 11.5 Error Classes f. 11.6 JSON Serialization and Parsing i. 11.6.1 JSON Customizations g. 11.7 The Internationalization API i. 11.7.1 Formatting Numbers ii. 11.7.2 Formatting Dates and Times iii. 11.7.3 Comparing Strings h. 11.8 The Console API i. 11.8.1 Formatted Output with Console i. 11.9 URL APIs i. 11.9.1 Legacy URL Functions j. 11.10 Timers k. 11.11 Summary 13. Iterators and Generators a. 12.1 How Iterators Work b. 12.2 Implementing Iterable Objects i. 12.2.1 “Closing” an Iterator: The Return Method c. 12.3 Generators i. 12.3.1 Generator Examples ii. 12.3.2 yield* and Recursive Generators d. 12.4 Advanced Generator Features i. 12.4.1 The Return Value of a Generator Function ii. 12.4.2 The Value of a yield Expression iii. 12.4.3 The return() and throw() Methods of a Generator iv. 12.4.4 A Final Note About Generators e. 12.5 Summary 14. Asynchronous JavaScript a. 13.1 Asynchronous Programming with Callbacks i. 13.1.1 Timers ii. 13.1.2 Events iii. 13.1.3 Network Events iv. 13.1.4 Callbacks and Events in Node b. 13.2 Promises i. 13.2.1 Using Promises ii. 13.2.2 Chaining Promises iii. 13.2.3 Resolving Promises iv. 13.2.4 More on Promises and Errors v. 13.2.5 Promises in Parallel vi. 13.2.6 Making Promises vii. 13.2.7 Promises in Sequence c. 13.3 async and await i. 13.3.1 await Expressions ii. 13.3.2 async Functions iii. 13.3.3 Awaiting Multiple Promises iv. 13.3.4 Implementation Details d. 13.4 Asynchronous Iteration i. 13.4.1 The for/await Loop ii. 13.4.2 Asynchronous Iterators iii. 13.4.3 Asynchronous Generators iv. 13.4.4 Implementing Asynchronous Iterators e. 13.5 Summary 15. Metaprogramming a. 14.1 Property Attributes b. 14.2 Object Extensibility c. 14.3 The prototype Attribute d. 14.4 Well-Known Symbols i. 14.4.1 Symbol.iterator and Symbol.asyncIterator ii. 14.4.2 Symbol.hasInstance iii. 14.4.3 Symbol.toStringTag iv. 14.4.4 Symbol.species v. 14.4.5 Symbol.isConcatSpreadable vi. 14.4.6 Pattern-Matching Symbols vii. 14.4.7 Symbol.toPrimitive viii. 14.4.8 Symbol.unscopables e. 14.5 Template Tags f. 14.6 The Reflect API g. 14.7 Proxy Objects i. 14.7.1 Proxy Invariants h. 14.8 Summary 16. JavaScript in Web Browsers a. 15.1 Web Programming Basics i. 15.1.1 JavaScript in HTML