Each set of exercises is paired
with a chapter of the book.
Shop for it at Amazon
Interactive Exercises
Click to select a chapter to practice.
Alerts
Variables
Variables for Numbers
Variable Names Legal and Illegal
Math expressions and operators
++ and --
Math expressions: Eliminating ambiguity
Concatenating text strings
The template literal
Prompts
Commenting
if statements
Comparison operators
if...else and else...if statements
A shortcut for if...else
Testing for a set of conditions
Where to put your JavaScript code
There are no exercises for this chapter
There are no exercises for this chapter
The const keyword
Arrays
Arrays: pop(), push(), shift(), and unshift()
Arrays: splice()
Arrays: slice()
Arrays: includes(), Array.from(), Array.of()
for loops
More about for loops
Flags and Booleans
for loops: break, continue, and length
Nested loops
for...of
Strings: changing case
Strings: Targeting a character and extracting parts
Measuring a string
Strings: finding segments
Strings: finding a character at a location
Replacing strings
Rounding numbers
Generating pseudo-random numbers
Converting strings to integers and strings to decimal numbers
Controlling the length of decimal numbers
Some more Math methods
Creating a Date object
Extracting parts of the Date object
Setting elements of a Date object
Working with a Date object
Functions
Functions: passing them data
Functions: sending data back from them
A function call can replace a variable
Functions: returning multiple values
Anonymous functions
Arrow functions
Sorting an array
Looping through an array with .forEach()
Local scope vs. global scope
There are no exercises for this chapter
There are no exercises for this chapter
The versatility of functions
Closures
switch statements: how to start them
switch statements: how to complete them
while loops
do...while loops
Event listeners
Targeting an element
Callbacks
Getting and setting a value in a field
textContent
innerHTML
classList
More on classList, plus className
Adding or changing attribute values
Targeting multiple elements
Getting attribute values, removing attributes
Objects and properties
Objects and properties: the dot that connects them
Objects: alternative coding options
Objects: methods
The bind() method
The object constructor function
Objects: adding methods to constructor functions
Objects: prototypes
Objects: checking for properties and methods
There are no exercises for this chapter
The HTTP request
The spread operator
Destructuring arrays and objects
ES6 classes
Creating a new class by inheritance
Adding to the child class
The first six data types
The seventh data type, Symbol
There are no exercises for this chapter
Modules
More ways to do modules
Sets
Sets: Constructing, measuring, deleting, and checking
Sets: converting a set to an array
Loops for sets
Maps
Maps: rules for their keys and methods
The map() method
Planning for failure
Promises - a silly example
The rest of the promise
A practical promise
The DOM
The DOM: the rule of thumb
There are no exercises for this chapter
The DOM: children
The DOM: nodeName, parentNode, and chaining
The DOM: siblings and element siblings
The DOM: firstChild, lastChild, firstChildren, lastChildren
The DOM: comments and attributes
The DOM: getElementsByTagName() and getElementsByClassName()
The DOM: creating nodes
The DOM: Inserting, replacing, and removing nodes