Check out example codes for "JavaScript append HTML". It will help you in understanding the concepts better.

Code Example 1

var node = document.createElement("LI");                 // Create a <li> node

 var textnode = document.createTextNode("Water");         // Create a text node

 node.appendChild(textnode);                              // Append the text to <li>

 document.getElementById("myList").appendChild(node);     // Append <li> to <ul> with id="myList"

Code Example 2

let parent = document.createElement("div")
parent.append("Some text")

console.log(parent.textContent) // "Some text"

Code Example 3

//create and append element
 var node = document.createElement("LI");                 // Create a <li> node

 var textnode = document.createTextNode("Water");         // Create a text node

 node.appendChild(textnode);                              // Append the text to <li>

 document.getElementById("myList").appendChild(node);     // Append <li> to <ul> with id="myList"

Code Example 4

var div = document.getElementById('myElementID');
div.innerHTML += "Here is some more data appended";

Code Example 5

var element = document.getElementById("div1");
element.insertBefore(para, element.firstChild);

Code Example 6

let app = document.querySelector('#app');
app.append('append() Text Demo');

console.log(app.textContent);

Learn ReactJs, React Native from akashmittal.com