There are some things in Javascript that will, to learners, appear like a obvious hole. One of these is removing a DOM element.

jQuery has a .remove() function, but it’s worth knowing how to do the same thing in raw JavaScript. Besides, it’s deceptively easy:

Object.prototype.remove() = function() {
    this.parentNode.removeChild(this);
}

Because the function has been added to the prototype, we can now call .remove() on any element.