https://exploringjs.com/impatient-js/toc.html Homepage Please support this book: buy it or donate (Ad, please don't block.) JavaScript for impatient programmers Table of contents * I Background + 1 Before you buy the book o 1.1 About the content o 1.2 Previewing and buying this book o 1.3 About the author o 1.4 Acknowledgements + 2 FAQ: book and supplementary material o 2.1 How to read this book o 2.2 I own a digital version o 2.3 I own the print version o 2.4 Notations and conventions + 3 History and evolution of JavaScript o 3.1 How JavaScript was created o 3.2 Standardizing JavaScript o 3.3 Timeline of ECMAScript versions o 3.4 Ecma Technical Committee 39 (TC39) o 3.5 The TC39 process o 3.6 FAQ: TC39 process o 3.7 Evolving JavaScript: Don't break the web + 4 New JavaScript features o 4.1 New in ECMAScript 2021 o 4.2 New in ECMAScript 2020 o 4.3 New in ECMAScript 2019 o 4.4 New in ECMAScript 2018 o 4.5 New in ECMAScript 2017 o 4.6 New in ECMAScript 2016 o 4.7 Source of this chapter + 5 FAQ: JavaScript o 5.1 What are good references for JavaScript? o 5.2 How do I find out what JavaScript features are supported where? o 5.3 Where can I look up what features are planned for JavaScript? o 5.4 Why does JavaScript fail silently so often? o 5.5 Why can't we clean up JavaScript, by removing quirks and outdated features? o 5.6 How can I quickly try out a piece of JavaScript code? * II First steps + 6 Using JavaScript: the big picture o 6.1 What are you learning in this book? o 6.2 The structure of browsers and Node.js o 6.3 JavaScript references o 6.4 Further reading + 7 Syntax o 7.1 An overview of JavaScript's syntax o 7.2 (Advanced) o 7.3 Identifiers o 7.4 Statement vs. expression o 7.5 Ambiguous syntax o 7.6 Semicolons o 7.7 Automatic semicolon insertion (ASI) o 7.8 Semicolons: best practices o 7.9 Strict mode vs. sloppy mode + 8 Consoles: interactive JavaScript command lines o 8.1 Trying out JavaScript code o 8.2 The console.* API: printing data and more + 9 Assertion API o 9.1 Assertions in software development o 9.2 How assertions are used in this book o 9.3 Normal comparison vs. deep comparison o 9.4 Quick reference: module assert + 10 Getting started with quizzes and exercises o 10.1 Quizzes o 10.2 Exercises o 10.3 Unit tests in JavaScript * III Variables and values + 11 Variables and assignment o 11.1 let o 11.2 const o 11.3 Deciding between const and let o 11.4 The scope of a variable o 11.5 (Advanced) o 11.6 Terminology: static vs. dynamic o 11.7 Global variables and the global object o 11.8 Declarations: scope and activation o 11.9 Closures + 12 Values o 12.1 What's a type? o 12.2 JavaScript's type hierarchy o 12.3 The types of the language specification o 12.4 Primitive values vs. objects o 12.5 The operators typeof and instanceof: what's the type of a value? o 12.6 Classes and constructor functions o 12.7 Converting between types + 13 Operators o 13.1 Making sense of operators o 13.2 The plus operator (+) o 13.3 Assignment operators o 13.4 Equality: == vs. === o 13.5 Ordering operators o 13.6 Various other operators * IV Primitive values + 14 The non-values undefined and null o 14.1 undefined vs. null o 14.2 Occurrences of undefined and null o 14.3 Checking for undefined or null o 14.4 The nullish coalescing operator (??) for default values [ES2020] o 14.5 undefined and null don't have properties o 14.6 The history of undefined and null + 15 Booleans o 15.1 Converting to boolean o 15.2 Falsy and truthy values o 15.3 Truthiness-based existence checks o 15.4 Conditional operator (? :) o 15.5 Binary logical operators: And (x && y), Or (x || y) o 15.6 Logical Not (!) + 16 Numbers o 16.1 Numbers are used for both floating point numbers and integers o 16.2 Number literals o 16.3 Arithmetic operators o 16.4 Converting to number o 16.5 Error values o 16.6 The precision of numbers: careful with decimal fractions o 16.7 (Advanced) o 16.8 Background: floating point precision o 16.9 Integer numbers in JavaScript o 16.10 Bitwise operators o 16.11 Quick reference: numbers + 17 Math o 17.1 Data properties o 17.2 Exponents, roots, logarithms o 17.3 Rounding o 17.4 Trigonometric Functions o 17.5 Various other functions o 17.6 Sources + 18 Bigints - arbitrary-precision integers [ES2020] (advanced) o 18.1 Why bigints? o 18.2 Bigints o 18.3 Bigint literals o 18.4 Reusing number operators for bigints (overloading) o 18.5 The wrapper constructor BigInt o 18.6 Coercing bigints to other primitive types o 18.7 TypedArrays and DataView operations for 64-bit values o 18.8 Bigints and JSON o 18.9 FAQ: Bigints + 19 Unicode - a brief introduction (advanced) o 19.1 Code points vs. code units o 19.2 Encodings used in web development: UTF-16 and UTF-8 o 19.3 Grapheme clusters - the real characters + 20 Strings o 20.1 Plain string literals o 20.2 Accessing characters and code points o 20.3 String concatenation via + o 20.4 Converting to string o 20.5 Comparing strings o 20.6 Atoms of text: Unicode characters, JavaScript characters, grapheme clusters o 20.7 Quick reference: Strings + 21 Using template literals and tagged templates o 21.1 Disambiguation: "template" o 21.2 Template literals o 21.3 Tagged templates o 21.4 Examples of tagged templates (as provided via libraries) o 21.5 Raw string literals o 21.6 (Advanced) o 21.7 Multiline template literals and indentation o 21.8 Simple templating via template literals + 22 Symbols o 22.1 Symbols are primitives that are also like objects o 22.2 The descriptions of symbols o 22.3 Use cases for symbols o 22.4 Publicly known symbols o 22.5 Converting symbols * V Control flow and data flow + 23 Control flow statements o 23.1 Controlling loops: break and continue o 23.2 Conditions of control flow statements o 23.3 if statements [ES1] o 23.4 switch statements [ES3] o 23.5 while loops [ES1] o 23.6 do-while loops [ES3] o 23.7 for loops [ES1] o 23.8 for-of loops [ES6] o 23.9 for-await-of loops [ES2018] o 23.10 for-in loops (avoid) [ES1] o 23.11 Recomendations for looping + 24 Exception handling o 24.1 Motivation: throwing and catching exceptions o 24.2 throw o 24.3 The try statement o 24.4 Error classes + 25 Callable values o 25.1 Kinds of functions o 25.2 Ordinary functions o 25.3 Specialized functions o 25.4 Summary: kinds of callable values o 25.5 Returning values from functions and methods o 25.6 Parameter handling o 25.7 Methods of functions: .call(), .apply(), .bind() + 26 Evaluating code dynamically: eval(), new Function() (advanced) o 26.1 eval() o 26.2 new Function() o 26.3 Recommendations * VI Modularity + 27 Modules o 27.1 Overview: syntax of ECMAScript modules o 27.2 JavaScript source code formats o 27.3 Before we had modules, we had scripts o 27.4 Module systems created prior to ES6 o 27.5 ECMAScript modules o 27.6 Named exports and imports o 27.7 Default exports and imports o 27.8 More details on exporting and importing o 27.9 npm packages o 27.10 Naming modules o 27.11 Module specifiers o 27.12 Loading modules dynamically via import() [ES2020] o 27.13 import.meta - metadata for the current module [ES2020] o 27.14 Polyfills: emulating native web platform features (advanced) + 28 Single objects o 28.1 What is an object? o 28.2 Objects as records o 28.3 Spreading into object literals (...) [ES2018] o 28.4 Methods and the special variable this o 28.5 Optional chaining for property accesses and method calls [ES2020] (advanced) o 28.6 Objects as dictionaries (advanced) o 28.7 Standard methods (advanced) o 28.8 Advanced topics + 29 Prototype chains and classes o 29.1 Prototype chains o 29.2 Classes o 29.3 Private data for classes o 29.4 Subclassing o 29.5 FAQ: objects * VII Collections + 30 Synchronous iteration o 30.1 What is synchronous iteration about? o 30.2 Core iteration constructs: iterables and iterators o 30.3 Iterating manually o 30.4 Iteration in practice o 30.5 Quick reference: synchronous iteration + 31 Arrays (Array) o 31.1 The two roles of Arrays in JavaScript o 31.2 Basic Array operations o 31.3 for-of and Arrays [ES6] o 31.4 Array-like objects o 31.5 Converting iterable and Array-like values to Arrays o 31.6 Creating and filling Arrays with arbitrary lengths o 31.7 Multidimensional Arrays o 31.8 More Array features (advanced) o 31.9 Adding and removing elements (destructively and non-destructively) o 31.10 Methods: iteration and transformation (.find(), .map(), .filter(), etc.) o 31.11 .sort(): sorting Arrays o 31.12 Quick reference: Array + 32 Typed Arrays: handling binary data (advanced) o 32.1 The basics of the API o 32.2 Element types o 32.3 More information on Typed Arrays o 32.4 Quick references: indices vs. offsets o 32.5 Quick reference: ArrayBuffers o 32.6 Quick reference: Typed Arrays o 32.7 Quick reference: DataViews + 33 Maps (Map) o 33.1 Using Maps o 33.2 Example: Counting characters o 33.3 A few more details about the keys of Maps (advanced) o 33.4 Missing Map operations o 33.5 Quick reference: Map o 33.6 FAQ: Maps + 34 WeakMaps (WeakMap) (advanced) o 34.1 WeakMaps are black boxes o 34.2 The keys of a WeakMap are weakly held o 34.3 Examples o 34.4 WeakMap API + 35 Sets (Set) o 35.1 Using Sets o 35.2 Examples of using Sets o 35.3 What Set elements are considered equal? o 35.4 Missing Set operations o 35.5 Quick reference: Set o 35.6 FAQ: Sets + 36 WeakSets (WeakSet) (advanced) o 36.1 Example: Marking objects as safe to use with a method o 36.2 WeakSet API + 37 Destructuring o 37.1 A first taste of destructuring o 37.2 Constructing vs. extracting o 37.3 Where can we destructure? o 37.4 Object-destructuring o 37.5 Array-destructuring o 37.6 Examples of destructuring o 37.7 What happens if a pattern part does not match anything? o 37.8 What values can't be destructured? o 37.9 (Advanced) o 37.10 Default values o 37.11 Parameter definitions are similar to destructuring o 37.12 Nested destructuring + 38 Synchronous generators (advanced) o 38.1 What are synchronous generators? o 38.2 Calling generators from generators (advanced) o 38.3 Background: external iteration vs. internal iteration o 38.4 Use case for generators: reusing traversals o 38.5 Advanced features of generators * VIII Asynchronicity + 39 Asynchronous programming in JavaScript o 39.1 A roadmap for asynchronous programming in JavaScript o 39.2 The call stack o 39.3 The event loop o 39.4 How to avoid blocking the JavaScript process o 39.5 Patterns for delivering asynchronous results o 39.6 Asynchronous code: the downsides o 39.7 Resources + 40 Promises for asynchronous programming [ES6] o 40.1 The basics of using Promises o 40.2 Examples o 40.3 Error handling: don't mix rejections and exceptions o 40.4 Promise-based functions start synchronously, settle asynchronously o 40.5 Promise combinator functions: working with Arrays of Promises o 40.6 Concurrency and Promise.all() (advanced) o 40.7 Tips for chaining Promises o 40.8 Quick reference: Promise combinator functions + 41 Async functions o 41.1 Async functions: the basics o 41.2 Returning from async functions o 41.3 await: working with Promises o 41.4 (Advanced) o 41.5 Immediately invoked async arrow functions o 41.6 Concurrency and await o 41.7 Tips for using async functions + 42 Asynchronous iteration o 42.1 Basic asynchronous iteration o 42.2 Asynchronous generators o 42.3 Async iteration over Node.js streams * IX More standard library + 43 Regular expressions (RegExp) o 43.1 Creating regular expressions o 43.2 Syntax o 43.3 Flags o 43.4 Properties of regular expression objects o 43.5 Methods for working with regular expressions o 43.6 The flags /g and /y, and the property .lastIndex (advanced) o 43.7 Techniques for working with regular expressions + 44 Dates (Date) o 44.1 Best practice: avoid the built-in Date o 44.2 Time standards o 44.3 Background: date time formats (ISO) o 44.4 Time values o 44.5 Creating Dates o 44.6 Getters and setters o 44.7 Converting Dates to strings + 45 Creating and parsing JSON (JSON) o 45.1 The discovery and standardization of JSON o 45.2 JSON syntax o 45.3 Using the JSON API o 45.4 Customizing stringification and parsing (advanced) o 45.5 FAQ + 46 Where are the remaining chapters? * X Appendices + A Index