Skip to content

Commit

Permalink
attempt 11
Browse files Browse the repository at this point in the history
  • Loading branch information
iLikeGrape committed Nov 14, 2024
1 parent a043b66 commit c2405fc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ function cellClicked(){
if(options[cellIndex] != "" || !running){
return;
}
changePlayer();

updateCell(this, cellIndex);
checkWinner();
}
function updateCell(cell, index){
changePlayer();
options[index] = currentPlayer;
cell.textContent = currentPlayer;
}
Expand All @@ -60,7 +59,6 @@ function checkWinner(){
}
}
if(roundWon){
changePlayer();
statusText.textContent = `${currentPlayer} wins!`;
running = false;
}
Expand All @@ -69,6 +67,7 @@ function checkWinner(){
running = false;
}
else{
changePlayer();
}
}
function restartGame(){
Expand Down

0 comments on commit c2405fc

Please sign in to comment.