79080768

Date: 2024-10-12 10:14:54
Score: 1
Natty:
Report link

this is how i did using for each loop

buttons.forEach((button) => { 
button.addEventListener("click", () => {
    console.log("box was clicked"); //simply making print box was clicked each time user clicks it 
    if (turnO){
        button.innerText = ("O")// if first time a button is clicked it will show O
        turnO = false; // after player O has taken a turn it will then become false 
    } else 
    button.innerText = ("X")
    turnO = true;
});
Reasons:
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: user27764150