JavaScript Output
console.log() writes to the developer console and is the best tool for testing. You can also change what the page displays with textContent or innerHTML, or show a pop up with alert().
document.write() replaces the page when used after loading, so avoid it in real projects.
Example
console.log("Written to the console");
document.getElementById("demo").textContent = "Written to the page";Exercise
Write the text onto the page element.
demo. = "Hi";
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.