Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const X_CLASS = 'x'
const CIRCLE_CLASS = 'circle'
const X_CLASS = 'x';
const CIRCLE_CLASS = 'circle';
const WINNING_COMBINATIONS = [
[0, 1, 2],
[3, 4, 5],
Expand All @@ -10,16 +10,16 @@ const WINNING_COMBINATIONS = [
[0, 4, 8],
[2, 4, 6]
]
const cellElements = document.querySelectorAll('[data-cell]')
const board = document.getElementById('board')
const winningMessageElement = document.getElementById('winningMessage')
const restartButton = document.getElementById('restartButton')
const winningMessageTextElement = document.querySelector('[data-winning-message-text]')
let circleTurn
const cellElements = document.querySelectorAll('[data-cell]');
const board = document.getElementById('board');
const winningMessageElement = document.getElementById('winningMessage');
const restartButton = document.getElementById('restartButton');
const winningMessageTextElement = document.querySelector('[data-winning-message-text]');
let circleTurn;

startGame()

restartButton.addEventListener('click', startGame)
restartButton.addEventListener('click', startGame);

function startGame() {
circleTurn = false
Expand Down Expand Up @@ -86,4 +86,4 @@ function checkWin(currentClass) {
return cellElements[index].classList.contains(currentClass)
})
})
}
}