Week 03 / JavaScript · values, functions, events, and the DOM
Make the page respond.
The idea
JavaScript lets a page react to a person. Store information in values, put reusable steps in functions, and listen for browser events such as clicks. The DOM is the browser’s live tree of page elements.
A button updates a message
const button = document.querySelector("#hello");
const message = document.querySelector("#message");
button.addEventListener("click", () => {
message.textContent = "You clicked it!";
});Build it
Work through these steps in your own project. Check them off as you go; your checklist stays in this browser.
What event starts your interaction, and which page element changes?
Notes save in this browser.