Como fazer remover o Button na mesa usando o JS DOM

   var td5 = document.createElement('td');
    td5.setAttribute("id", "td5");
    td5.innerHTML = `<button onclick=remove(this.parentElement)> X </button>`
    tr.appendChild(td5);
}
}
function remove(element) {
    element.parentElement.remove(element);
    console.log(element.parentElement);
    allMovie.splice(tr, 1);
    set();
}
Weary Weasel