Grade 9
Scope and closures
Three lessons, then a test against Buggsy.
What you’ll learn
- Scope decides where a variable can be seen.
- Global scope: the hallway, visible everywhere. Function scope: your bedroom. Block scope (
{ }withlet/const): your closet. varignores blocks and leaks out of them. Another reason to useletandconst.- Shadowing: an inner variable with the same name hides the outer one.
- The scope chain: JavaScript looks in the current scope, then outward, all the way to global.
- Hoisting: function declarations can be called before they appear.
let/constcan’t be used before their line. - A closure is a function that remembers the variables from where it was created, like a backpack.
The lessons
- Hallways, bedrooms and closets Global, function and block scope, and why var leaks.
- Shadowing, chains and hoisting When names collide, how JavaScript looks things up, and hoisting.
- Closures: functions with backpacks Functions that remember, private data and the secret vault.
Grade 10
Array power tools
Three lessons, then a test against Buggsy.
What you’ll learn
- Array methods take a callback function, called once per item:
(item, index, array) => … forEachdoes something for each item (returns nothing).maptransforms every item into a new array of the same length.filterkeeps the items where the callback returns true.findreturns the first match (orundefined);findIndexreturns its index (or -1).someasks “is any true?”;everyasks “are all true?”reduce((total, item) => …, start)boils an array down to one value.- Chain them into pipelines:
.filter(…).map(…).reduce(…).
The lessons
- forEach and map Loop without the loop, and transform every item.
- filter, find, some and every Keep some items, find one, or ask yes-or-no questions.
- reduce, sort and chaining Boil an array down, sort it properly, and build data pipelines.
Grade 11
The DOM: controlling the page
Three lessons, then a test against Buggsy.
What you’ll learn
- The DOM is the browser’s live tree of the page. JavaScript can read and change it.
document.querySelector("css selector")finds the first match;querySelectorAllfinds all of them.document.getElementById("id")finds an element by its id.el.textContent = "…"changes text safely.innerHTMLparses HTML, so never use it with user input.el.style.color = "red"changes one style;el.classList.add/remove/toggle("name")is better.el.setAttribute(name, value);data-*attributes appear inel.dataset.document.createElement("li"), thenparent.append(child);el.remove()removes it.
The lessons
- Meet the DOM The page as a tree, and how to select elements.
- Changing the page Text, HTML, styles, classes and attributes.
- Creating and removing elements Build new elements, add them to the page, and build lists from data.
Grade 12
Events: reacting to people
Three lessons, then a test against Buggsy.
What you’ll learn
el.addEventListener("click", handler)runshandlerevery time the event happens.- Common events:
click,input,change,submit,keydown,mouseover,DOMContentLoaded. - The handler receives an event object:
event.targetis the element,event.keythe key pressed. - Read an input with
input.value(always a string). - Forms: listen for
submitand callevent.preventDefault()to stop the page reloading. - Events bubble up to parents. Event delegation: one listener on a parent handles all its children.
localStorage.setItem(key, string)andgetItem(key)remember things between visits. Use JSON for objects.
The lessons
- Listening for events addEventListener, named handlers and the most common events.
- The event object and forms event.target, reading inputs, live updates and preventDefault.
- Bubbling, delegation and saving How events travel, one listener for many items, and localStorage.
Grade 13
Modern JavaScript
Three lessons, then a test against Buggsy.
What you’ll learn
- Spread
...unpacks:[...a, ...b],{ ...obj, x: 1 },Math.max(...nums). - Rest
...packs up:function sum(...nums),const [first, ...others] = list. - Destructuring deluxe: swap with
[a, b] = [b, a], nested patterns, defaults, renaming. - Optional chaining
user?.address?.citygivesundefinedinstead of crashing. - Nullish coalescing
a ?? buses b only if a isnullorundefined(unlike||). &&and||return one of their values;||=,&&=and??=assign smartly.Setholds unique values;Mapholds key-value pairs with any type of key;Datehandles dates.
The lessons
- Spread, rest and destructuring Three dots that unpack and pack, and destructuring deluxe.
- ?. ?? and short-circuit tricks Optional chaining, nullish coalescing and logical assignment.
- Sets, Maps and Dates Unique collections, flexible key-value pairs, and working with time.
Class starts whenever you’re ready
Every lesson is free, there’s nothing to sign up for, and your progress saves as you go.