Skip to content

Commit

Permalink
Add event Listener for each tabular cell
Browse files Browse the repository at this point in the history
  • Loading branch information
atchutchi committed May 16, 2023
1 parent 89cea70 commit 637febb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion assets/js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,13 @@ const winningCombinations = [
[2, 5, 8],
[0, 4, 8],
[2, 4, 6]
];
];

// Identify who the current player is.
let currentPlayer = "X";

// Adds an event listener to each cell.
for (let i = 1; i <= 9; i++) {
const cell = document.getElementById(`cell${i}`);
cell.addEventListener("click", handleCellClick);
}

0 comments on commit 637febb

Please sign in to comment.