'Clear game board in tic-tac-toe to restart game only using JavaScript
This is my code but I don't quite get it on how to delete/clear the mark in markboard function in previous game to pave way for the new game. Below is my code. I think in markBoard(position, mark).clear(mark), there's some error to it but I don't know how to correct.
while(winnerIdentified){
let yesNo = prompt(`Play another game?(y/n)`);
console.log(`${yesNo}`);
if (restartGame(yesNo) == true){
markBoard(position, mark).clear(mark)
playTurn()
winnerIdentified = false
}
else{
console.log("Goodbye, see you again! ~(*.*)~");
break; //close window once user decided to exit game
}}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
