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

13th Oct 2022, 11:59 PM
Triz
Triz - avatar
4 Respuestas
+ 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; }
14th Oct 2022, 1:34 AM
Bob_Li
Bob_Li - avatar
+ 2
Bob_Li Thank you very much!!! I really appreciate it.
14th Oct 2022, 1:53 AM
Triz
Triz - avatar
+ 1
your css is incomplete...
14th Oct 2022, 12:21 AM
Bob_Li
Bob_Li - avatar
0
Bob_Li I fixed it
14th Oct 2022, 12:24 AM
Triz
Triz - avatar