Adding and Removing Elements
javascriptCopy codeconst newDiv = document.createElement('div');
document.body.appendChild(newDiv);javascriptCopy codeconst newDiv = document.createElement('div');
document.body.appendChild(newDiv);
const newPara = document.createElement('p');
newDiv.appendChild(newPara);javascriptCopy codeconst parent = document.getElementById('parent');
const child = document.getElementById('child');
parent.removeChild(child);Last updated