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

🎤 interview

What is event delegation?

🎤 interview

Double equals or triple equals?

🎤 interview

Debounce or throttle?

🎤 interview

What runs first: setTimeout 0 or a Promise?

📚 tutorial

What is a closure?

💎 deep

Edit any website live?

💎 deep

Reading custom attributes?

🔧 useful

Crashing on undefined again?