function jogar()
{
let b1 = document.getElementById ("cx1").value;
let b2 = document.getElementById ("cx2").value;
let b3 = document.getElementById ("cx3").value;
let b4 = document.getElementById ("cx4").value;
let b5 = document.getElementById ("cx5").value;
let b6 = document.getElementById ("cx6").value;
let b7 = document.getElementById ("cx7").value;
let b8 = document.getElementById ("cx8").value;
let b9 = document.getElementById ("cx9").value;
let jogadas = [b1,b2,b3,b4,b5,b6,b7,b8,b9];
let resultadoX = [
[b1==x,b2==x,b3==x]
[b4==x,b5==x,b6==x]
[b7==x,b8==x,b9==x]
[b1==x,b5==x,b9==x]
[b3==x,b5==x,b7==x]
];
let resultadoO = [
[b1==o,b2==o,b3==o]
[b4==o,b5==o,b6==o]
[b7==o,b8==o,b9==o]
[b1==o,b5==o,b9==o]
[b3==o,b5==o,b7==o]
];
if (jogadas==resultadoX) {
document.write('X ganhou')
}
else
if (jogadas==resultadoO) {
document.write('O ganhou')
}
}
É um jogo da velha em javascript. Fiz ele no if e else e estou tentando fazer no array mas nao sei onde estou errando ou se estou completamente errado. É a primeira vez que utilizo a plataforma. Obrigado pela atenção.