JavaScript & the DOM
JS is how a page listens, reacts, and gossips.
▶ the lesson · ~35s · narrated · tap for sound
the intro
JavaScript makes pages interactive. The browser exposes the page as the DOM — a live tree of objects — and JavaScript can find nodes, listen for events, and change anything. Master querySelector, addEventListener, and events like click and input, and you can build real behavior.
the sample
listen, react, update
const btn = document.querySelector("#go")
btn.addEventListener("click", () => {
document.querySelector("#out")
.textContent = "clicked!"
})fun fact ✦
JavaScript was created in 10 days in 1995 — and `typeof null === "object"` is still here from that week.
the docs
quick hits about JavaScript & the DOM
15-second answers · interviews, tips, trivia & hidden gems
What is event delegation?
Double equals or triple equals?
Debounce or throttle?
What runs first: setTimeout 0 or a Promise?
What is a closure?
Edit any website live?
Reading custom attributes?
Crashing on undefined again?