JavaScript HTML DOM
<!DOCTYPE html> <html> <body> <h1 id="main-title">Hello, World!</h1> <script> // Find an element by its id const heading = document.getElementById("main-title"); // Read its current text console.log(heading.textContent); // Change what the user sees heading.textContent = "Welcome to the DOM"; // The <title> shown in the browser tab is also part of the document document.title = "Learning the DOM"; </script> </body> </html>