is there a better fuction then check4winner() for my tictactoe board
- by Hespino
function check4Winner(){
winningCombinations = [[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]];
for(var a = 0; a < winningCombinations.length; a++){
if(squares[winningCombinations[a][0]]==currentPlayer&&
squares[winningCombinations[a][1]]==currentPlayer&&
squares[winningCombinations[a][2]]==currentPlayer){
winner=true;
alert(currentPlayer+ " WON!");
}
}//forloop
}//end check4Winner().