innerHTML and textContent
The textContent property lets you get or set the text inside an element. It's the safest way to work with plain text!
// HTML:
<p id="message">Hello World!</p>
// Get the text
let text = document.getElementById("message").textContent;
console.log(text); // "Hello World!"
// Set new text
document.getElementById("message").textContent = "Welcome!";Original Text