For my simple tic tac toe game, I am currently checking for various win states. The game board is stored in an array, and to check for a win with the top three spaces, I am using the following logic:
if (tableArr[0].hasClass('userTaken') && tableArr[1].hasClass('userTaken') && tableArr[2].hasClass('userTaken')){
select(); //ends game
}
I am trying to find a way to condense this code. I attempted
tableArr[0,1,2].hasClass('userTaken')
but it did not work. Any advice on how to optimize this further?