This is generally what my code looks like. It's a 4x25 table with HTML/JS/CSS
<script>
var perkName = [
'Sturdy Energy',
'Resilient',
'Freedom',
];
</script>
<table>
<tr>
<td style='background-color: black'>
<button id='OneButton'onclick='removeOne()'>Select</button>
<td id='perkOne'></td>
<td id='perkOneEffect' style='text-align: left; padding-left: 5px'></td>
<td id='perkOnePercent'></td>
</tr>
<tr>
<td style='background-color: black'>
<button type='button' onclick='removeTwo()'> Select </button>
<td id='perkTwo'></td>
<td id='perkTwoEffect'style='text-align: left; padding-left: 5px'></td>
<td id='perkTwoPercent' value='...'></td>
</tr>
</table>
<script>
document.getElementById('perkOne').innerHTML = perkName[0];
document.getElementById('perkTwo').innerHTML = perkName[1];
</script>
What I'm trying to do on my table is have the button invoke the function below
function remove() {
var perkName = perkName.slice(1, 3);
}
after the button click it slices the array so that the table changes to index numbers 2 and 3.
when not in block scope it function as intended. I cannot call the function with a button to remove it by invoking the function.