node.remove() deletes an element directly — no parent reference needed. The legacy form is parent.removeChild(node), which also returns the removed node. To clear a container, set parent.replaceChildren() (or, carefully, innerHTML = ""). Removing a node also detaches its event listeners with it.