Intro. Few words about the book.
- A brief history of the book
- Structure of the book
- Who this book is for?
- Typographic conventions
- What’s the best way for following the examples?
- Errata and other requests
- About the author
- Acknowledgments
- Part 1 - JavaScript, the “hard” parts
Chapter 1. Getting started with JavaScript, and a glossary.
- The importance of being JavaScript
- ECMAScript, and other technical terms
- A special note on modern JavaScript
Chapter 2. Prologue: JavaScript fundamentals.
- Strings, numbers, variables and all in between
- The more you know
- Standing on the shoulders of a giant object
- 50 flavors of JavaScript functions
- JavaScript’s module system
- Conclusions
Chapter 3. A whirlwind tour of JavaScript engines.
- JavaScript engines and Global Memory
- Global Execution Context and Call Stack
- Asynchronous JavaScript, Callback Queue, and the Event Loop
- Callback hell and Promises
- Promises and error handling
- Promises and Microtask Queue
- More on Promise: combinators
- Dynamic imports
- Asynchronous evolution: from Promises to async/await
- Conclusions
Chapter 4. Closures and modules in JavaScript.
- Global madness
- Demystifying closures
- The need for closures
- Hoisting, we need to talk
- Conclusions
Chapter 5. JavaScript encounters of the third kind (with objects!)
- Everything is an object!
- Creating and linking objects
- Constructing JavaScript objects
- Checking the linkage
- Taking care of JavaScript objects
- Class illusion
- Conclusions
- Sharpen up your JavaScript skills
Chapter 6. This in JavaScript.
- Demystifying this
- Rule number 1: falling back to the global this
- Rule number 2: when this is my host object
- Rule number 3: tell me who is this
- Rule number 4: new binding
- Arrow functions and this
- Conclusions
- Sharpen up your JavaScript skills
- BONUS exercise: Creeping into this
Chapter 7. Types, coercion, and comparison in JavaScript.
- Primitive types in JavaScript
- When a number becomes a string
- I’m not a number!
- Comparison operators: equal equal or not?
- Primitives and objects
- Conclusions
- Sharpen up your JavaScript skills
- Part 2 - Working with JavaScript in the browser
Chapter 8. Shaping HTML elements with JavaScript.
- The Document Object Model
- Nodes, elements, and DOM manipulation
- DOM and events
- How to dynamically add DOM elements with JavaScript
- Conclusions
Chapter 9. Working with asynchronous JavaScript.
- REST API and XMLHttpRequest
- XMLHttpRequest in action: generating lists with HTML and JavaScript
- Building HTML lists with JavaScript (and debugging classes)
- Asynchronous evolution: from XMLHttpRequest to Fetch
- Rebuilding Fetch API from scratch (for fun and profit)
- What’s a polyfill?
- Conclusions
Chapter 10. HTML forms and playing with the storage API.
- A re-introduction to HTML forms
- HTML forms in action
- Extracting data from an HTML form
- Getting to know localStorage and laying out our classes
- Interacting with localStorage and this comes to bite again
- Going idiomatic with FormData
- The formdata event
- Conclusions
Chapter 11. First steps with TypeScript.
- Laying down the foundations
- Getting started with TypeScript
- Digging deeper into TypeScript types
- TypeScript types, objects, and interfaces
- Narrowing types, Partial, and type aliases
- Assembling a TypeScript class
- Wiring up our classes and a bit of JSDoc
- ECMAScript private fields and the TypeScript private modifier
- Conclusions
- Part 3 - Appendix
A delightful collection of little JavaScript recipes
Solutions
- Chapter 2. Prologue: JavaScript fundamentals
- Chapter 4. Closures and modules in JavaScript
- Chapter 6. This in JavaScript
- Chapter 11. First steps with TypeScript