Solution
document.querySelector("tbody").onclick = function(e){
// Find out which elem which was clicked
const clicked_elem = e.target;
// If this clicked elem is a button, then execute our code
if (clicked_elem.tagName == "BUTTON"){
// First identify which button was clicked
const index = clicked_elem.dataset.index
// Now get the td corresponding to that button
var x = document.getElementById("score_" + index);
if (x.style.display === "block") {
x.style.display = "none";
} else {
x.style.display = "block";
}
}
}