Concepts
Visual explanations of the ideas behind the problems.
0 of 56 learned
JavaScript
Fundamentals: Part 1
JavaScript has a small set of built-in types, and it converts between them automatically when an operator expects a different one.
When an expression mixes operators, precedence decides which one runs first, and associativity decides the order among operators of equal precedence.
Fundamentals: Part 2
let and const are block-scoped and unreachable until their line runs, while var is function-scoped and available as undefined from the top.
Every value is truthy unless it is one of a short, memorizable list of falsy values.
Behind the Scenes
JavaScript sets up all your declarations before it runs a single line of your code.
A variable lookup walks outward through nested scopes until it finds a match or runs out of places to look.
this is not fixed to a function; it is decided fresh by how that function gets called.
Every function call gets its own frame on a stack, and JavaScript only ever runs the frame on top.
Copying a number copies the value; copying an object copies a pointer to the same shared value.
Data Structures, Operators & Strings
Destructuring unpacks values from an array or an object straight into named variables.
The same ... syntax expands a value out in one context and gathers values together in the other.
?. stops a property lookup safely at the first null or undefined instead of throwing; ?? picks a default only for null or undefined.
A Set stores unique values with no duplicates; a Map stores key-value pairs with keys of any type and fast lookup.
Backtick strings let you drop expressions right into the text and write real multiline strings.
&&, ||, and ?? can skip evaluating their right side entirely, and the ternary operator picks exactly one of two values from a single condition.
These three methods turn an object's own properties into arrays you can loop, map, or filter like any other array.
A Closer Look at Functions
A function keeps access to the variables it was born in, even after that scope returns.
A function that takes another function in, gives one back out, or both.
Turning a multi-argument function into a chain of one-argument functions.
Three ways to control what this refers to when a function runs.
Two ways to tame a rapid-fire event: wait for quiet before reacting, or react on a steady schedule no matter how fast events arrive.
Working With Arrays
map transforms every element, filter keeps a subset, and reduce folds everything into one value.
Array.prototype.sort reorders elements in place, using a comparator's sign to decide each swap.
find, findIndex, some, every, and includes all scan an array and can stop as soon as they know the answer.
Numbers, Dates & Timers
Object-Oriented Programming
When an object does not have a property itself, JavaScript looks for it on the object's prototype instead.
A class is syntax on top of a constructor function and its prototype, not a new kind of object.
A getter runs code when a property is read, and a setter runs code when a property is assigned.
Asynchronous JavaScript
The engine finishes the current script, drains every pending microtask, then runs one task from the macrotask queue, on repeat.
A promise is a placeholder for a value that starts pending and settles exactly once, to fulfilled or rejected.
await pauses an async function until a promise settles, without blocking the rest of the program.
Microtasks, like promise callbacks, always run before the next macrotask, like a setTimeout, even a zero-delay one.
try/catch lets your code recover from a thrown error instead of crashing, and finally always cleans up.
Modern JavaScript
Each file is its own module with its own scope, and export/import wire live values between files, not copies.
To change one nested value without mutating anything, you copy every level on the path down to it, and reuse everything else as-is.
Beyond the Course (extra topics)
A pattern language for finding, testing, and pulling pieces out of text.
A generator writes a pausable, resumable function that hands out one value at a time.
JSON.stringify and JSON.parse move data to and from text, but not every value survives the trip.