- Values
- Numbers
- Arithmetic
- Special Numbers
- Strings
- Unary Operators
- Boolean Values
- Comparisons
- Logical Operators
- Undefined Values
- Automatic Type Conversion
- Short-Circuiting of Logical Operators
- Summary
- Expressions and Statements
- Variables
- Keywords and Reserved Words
- The Environment
- Functions
- The console
- Return Values
- Prompt and Confirm
- Control Flow
- Conditional Execution
- while and do Loops
- Indenting Code
- for Loops
- Breaking Out of a Loop
- Updating Variables Succinctly
- Dispatching on a Value with switch
- Capitalization
- Comments
- Summary
- Exercises
- Looping a Triangle
- FizzBuzz
- Chess Board
- Defining a Function
- Parameters and Scopes
- Nested Scopes
- Functions as Values
- Declaration Notation
- The Call Stack
- Optional Arguments
- Closure
- Recursion
- Growing Functions
- Functions and Side Effects
- Summary
- Exercises
- Minimum
- Recursion
- Bean Counting
- The Weresquirrel
- Data Sets
- Properties
- Methods
- Objects
- Mutability
- The Lycanthrope’s Log
- Computing Correlation
- Objects as Maps
- The Final Analysis
- Further Arrayology
- Strings and Their Properties
- The arguments Object
- The Math Object
- The Global Object
- Summary
- Exercises
- The Sum of a Range
- Reversing an Array
- A List
- Deep Comparison
- Abstraction
- Abstracting Array Traversal
- Higher-Order Functions
- Passing Along Arguments
- JSON
- Filtering an Array
- Transforming with map
- Summarizing with reduce
- Composability
- The Cost
- Great-great-great-great-
- Binding
- Summary
- Exercises
- Flattening
- Mother-Child Age Difference
- Historical Life Expectancy
- Every and Then Some
- History
- Methods
- Prototypes
- Constructors
- Overriding Derived Properties
- Prototype Interference
- Prototype-less Objects
- Polymorphism
- Laying Out a Table
- Getters and Setters
- Inheritance
- The instanceof Operator
- Summary
- Exercises
- A Vector Type
- Another Cell
- Sequence Interface
- Definition
- Representing Space
- A Critter’s Programming Interface
- The World Object
- this and Its Scope
- Animating Life
- It Moves
- More Life-forms
- A More Lifelike Simulation
- Action Handlers
- Populating the New World
- Bringing the World to Life
- Exercises
- Artificial Stupidity
- Predators
- Programmer Mistakes
- Strict Mode
- Testing
- Debugging
- Error Propagation
- Exceptions
- Cleaning Up After Exceptions
- Selective Catching
- Assertions
- Summary
- Exercises
- Retry
- The Locked Box
- Creating a Regular Expression
- Testing for Matches
- Matching a Set of Characters
- Repeating Parts of a Pattern
- Grouping Subexpressions
- Matches and Groups
- The Date Type
- Word and String Boundaries
- Choice Patterns
- The Mechanics of Matching
- Backtracking
- The replace Method
- Greed
- Dynamically Creating RegExp Objects
- The search Method
- The lastIndex Property
- Looping over Matches
- Parsing an INI File
- International Characters
- Summary
- Exercises
- Regexp Golf
- Quoting Style
- Numbers Again
- Why Modules Help
- Namespacing
- Reuse
- Decoupling
- Using Functions as Namespaces
- Objects as Interfaces
- Detaching from the Global Scope
- Evaluating Data as Code
- The require Function
- Slow-Loading Modules
- Interface Design
- Predictability
- Composability
- Layered Interfaces
- Summary
- Exercises
- Month Names
- A Return to Electronic Life
- Circular Dependencies
- Parsing
- The Evaluator
- Special Forms
- The Environment
- Functions
- Compilation
- Cheating
- Exercises
- Arrays
- Closure
- Comments
- Fixing Scope
- Networks and the Internet
- The Web
- HTML
- HTML and JavaScript
- In the Sandbox
- Compatibility and the Browser Wars
- Document Structure
- Trees
- The Standard
- Moving Through the Tree
- Finding Elements
- Changing the Document
- Creating Nodes
- Attributes
- Layout
- Styling
- Cascading Styles
- Query Selectors
- Positioning and Animating
- Summary
- Exercises
- Build a Table
- Elements by Tag Name
- The Cat’s Hat
- Event Handlers
- Events and DOM Nodes
- Event Objects
- Propagation
- Default Actions
- Key Events
- Mouse Clicks
- Mouse Motion
- Scroll Events
- Focus Events
- Load Event
- Script Execution Timeline
- Setting Timers
- Debouncing
- Summary
- Exercises
- Censored Keyboard
- Mouse Trail
- Tabs
- The Game
- The Technology
- Levels
- Reading a Level
- Actors
- Encapsulation as a Burden
- Drawing
- Motion and Collision
- Actors and Actions
- Tracking Keys
- Running the Game
- Exercises
- Game Over
- Pausing the Game
- SVG
- The Canvas Element
- Filling and Stroking
- Paths
- Curves
- Drawing a Pie Chart
- Text
- Images
- Transformation
- Storing and Clearing Transformations
- Back to the Game
- Choosing a Graphics Interface
- Summary
- Exercises
- Shapes
- The Pie Chart
- A Bouncing Ball
- Precomputed Mirroring
- The Protocol
- Browsers and HTTP
- XMLHttpRequest
- Sending a Request
- Asynchronous Requests
- Fetching XML Data
- HTTP Sandboxing
- Abstracting Requests
- Promises
- Appreciating HTTP
- Security and HTTPS
- Summary
- Exercises
- Content Negotiation
- Waiting for Multiple Promises
- Fields
- Focus
- Disabled Fields
- The Form as a Whole
- Text Fields
- Checkboxes and Radio Buttons
- Select Fields
- File Fields
- Storing Data Client-Side
- Summary
- Exercises
- A JavaScript Workbench
- Autocompletion
- Conway’s Game of Life
- Implementation
- Building the DOM
- The Foundation
- Tool Selection
- Color and Brush Size
- Saving
- Loading Image Files
- Finishing Up
- Exercises
- Rectangles
- Color Picker
- Flood Fill
- Background
- Asynchronicity
- The node Command
- Modules
- Installing with NPM
- The Filesystem Module
- The HTTP Module
- Streams
- A Simple File Server
- Error Handling
- Summary
- Exercises
- Content Negotiation, Again
- Fixing a Leak
- Creating Directories
- A Public Space on the Web
- Design
- Long Polling
- HTTP Interface
- The Server
- Routing
- Serving Files
- Talks as Resources
- Long-Polling Support
- The Client
- HTML
- Starting up
- Displaying Talks
- Updating the Server
- Noticing Changes
- Exercises
- Disk Persistence
- Comment Field Resets
- Better Templates
- The Unscriptables
- Staged Compilation
- Graph Layout
- Defining a Graph
- A First Force-Directed Layout Function
- Profiling
- Function Inlining
- Going Back to Old-school Loops
- Avoiding Work
- Creating Less Garbage
- Garbage Collection
- Writing to Objects
- Dynamic Types
- Summary
- Exercises
- Pathfinding
- Timing
- Optimizing