Generation

generate functionFri, 09 Jun 2023

make a function that receives a parent container and removes all its children

const removeAllChildren = parent => { while (parent.firstChild) { parent.removeChild(parent.firstChild); } }; removeAllChildren(document.querySelector('#p1'));

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant