Loops for,while,dowhile,foreach,forin
Create ,Replace and Remove
let element = document.createElement("a");
element.className = "created";
element.setAttribute('title', 'created-title');
element.setAttribute('href', '#');
let txt = document.createTextNode("this is text node");
element.appendChild(txt);
// element.innerHTML = " this is bold txt by inner html"
let anotherChild = document.querySelector(".container");
anotherChild.appendChild(element);
console.log(element);
//Replacing
let elementReplace = document.createElement("h2");
elementReplace.className = "new";
elementReplace.id = "new";
let txt2 = document.createTextNode("this is new txt node");
elementReplace.appendChild(txt2);
element.replaceWith(elementReplace);
//Replace
let repchild = document.querySelector('#replace');
let repchild1 = document.querySelector('#replace1');
let repchild2 = document.querySelector('#replace4');
let remchild = document.querySelector('#rep2');
let remchild3 = document.querySelector('#rep3');
//remove
repchild.replaceChild(repchild2, repchild1);
remchild.remove();
repchild.removeChild(remchild3);