how to display text using javascript code example Example: set text of dom element document.getElementById("myBtn").textContent = 'Hello World';