Remove last element from HTML using JavaScript
const someElement.document.getElementById('someId')
someElement.removeChild(someElement.lastChild);
Remove all elements from a HTM element using JavaScript using loop
document.getElementById('someId').prototype.empty = function() {
var that = this;
while (that.hasChildNodes()) {
that.removeChild(that.lastChild);
}
};
another way
const someElement = document.getElementById('someId');
someElement.innerHTML = '';