Lesson 24: Building a Simple Interactive App
Mini Project: Click Counter
Let’s build a counter that increases when a button is clicked.
let count = 0;
const button = document.querySelector("#count-btn");
const display = document.querySelector("#count-display");
button.addEventListener("click", () => {
count++;
display.textContent = "Count: " + count;
});
This ties together selection, event handling, and content updates.