How do you change the content of an HTML element in JavaScript?

Use element.textContent or element.innerHTML to set or change the content of an HTML element.

document.querySelector("#myDiv").textContent = "Hello, World!";