Student-friendly HTML, CSS, and JavaScript reference with examples
Removes an element from the page completely.
const box = document.querySelector('.box');
box.remove();
// The box is now gone from the page
Commonly used with delete buttons:
deleteBtn.addEventListener('click', function() {
item.remove();
});