Create script.js

This commit is contained in:
Voxel 2025-04-14 16:16:01 -04:00 committed by GitHub
parent 897ff5e673
commit 063b8498a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,10 @@
let board = ['', '', '', '', '', '', '', '', ''];
let currentPlayer = 'X';
function makeMove(index) {
if (!board[index]) {
board[index] = currentPlayer;
document.querySelectorAll('.cell')[index].textContent = currentPlayer;
currentPlayer = currentPlayer === 'X' ? 'O' : 'X';
}
}