Im fairly new to javascript, i got this problem that i cannot fix, i cant remove click event listener and here is my code:
function humanClick(event) {
const target = event.target
const nodeId = target.id;
BOARD[nodeId] = humanPlayer;
target.innerHTML = humanPlayer;
if (checkForWinner(BOARD) == null) {
aiPlay(BOARD);
};
target.removeEventListener("click", humanClick);
// adding listeners
nodes.forEach(node => {
node.innerText = null;
node.style.background = null;
node.addEventListener("click", humanClick);
});