0
Winner announced when just one tile is selected
Could someone assist me please? In the code below the comment: ‘determining winner’ (from JavaScript file), there seems to be some error but I can’t figure it out. Does anyone know what’s wrong? https://code.sololearn.com/W31nOKfdzzj7/?ref=app
4 Antworten
+ 3
//Determining Winner
if (
(arr[0]!=null && (arr[0]===arr[1]&&arr[1]===arr[2])) ||
(arr[3]!=null && (arr[3]===arr[4]&&arr[4]===arr[5])) ||
(arr[6]!=null && (arr[6]===arr[7]&&arr[7]===arr[8])) ||
(arr[0]!=null && (arr[0]===arr[3]&&arr[3]===arr[6])) ||
(arr[1]!=null && (arr[1]===arr[4]&&arr[4]===arr[7])) ||
(arr[2]!=null && (arr[2]===arr[5]&&arr[5]===arr[8])) ||
(arr[0]!=null && (arr[0]===arr[4]&&arr[4]===arr[8])) ||
(arr[2]!=null && (arr[2]===arr[4]&&arr[4]===arr[6]))
){
announcer.classList.add("you-won");
announcer.innerHTML= `Congratulations! ${lastPlayer} is the winner!`;
gameEnded=true;
}
+ 2
Bob_Li Thank you very much!!! I really appreciate it.
+ 1
your css is incomplete...
0
Bob_Li I fixed it