how to add element to dom code example
Example 1: javascript append to paragraph
// In the JS script
var parElement = document.getElementById("myPar");
var textToAdd = document.createTextNode("Text to be added");
parElement.appendChild(textToAdd);
//In the HTML file
<p id="myPar"></p>
Example 2: js create tag
//create div
let div = document.createElement('div');
//create button
let button = document.createElement('button');