21) How to write HTML code dynamically using JavaScript?

The innerHTML property is used to write the HTML code using JavaScript dynamically. Let’s see a simple example:

document.getElementById(‘mylocation’).innerHTML=”

This is heading using JavaScript

“;