<button id="button_A">Press me</button>
<h3 id="heading_A"></h3>Storing the information you need — Variables / notebook
Storing the information you need — Variables
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const buttonA = document.querySelector("#button_A");
const headingA = document.querySelector("#heading_A");
let count = 1;
buttonA.onclick = () => {
buttonA.textContent = "Try again!";
headingA.textContent = `${count} clicks so far`;
count += 1;
};