append to html node code example

Example 1: add a child html object to another html object in js

//Add child at end of object children list
parent.append(child);
//Add child at start of object children list
parent.insertBefore(child, list.childNodes[0]);

Example 2: appendchild javascript

const parent = document.createElement('div');
const child = document.createElement('p');
const appendValue = parent.append(child);
console.log(appendValue) // undefined
const appendChildValue = parent.appendChild(child);
console.log(appendChildValue) // <p><p>