The removeChild() method of the Node interface removes a child node from the DOM and returns the removed node.
removeChild()
MDN Reference