I am making a tic-tac-toe game for fun and I am trying to do something a little different.
I am currently trying to check winning combinations by iterating through an array of stored tds that were grabbed with Jquery.
WIN_COMBINATIONS = [$("#square_0, #square_1, #square_2"),
$("#square_6, #square_7, #square_8"),
$("#square_0, #square_3, #square_6"),
$("#square_3, #square_4, #square_5"),
$("#square_1, #square_4, #square_7"),
$("#square_2, #square_5, #square_8"),
$("#square_0, #square_4, #square_8"), $("#square_6, #square_4, #square_2")]
So, basically, WIN_COMBINATIONS[0] is a winning combo. What is the best way to iterate through, and actually check the .html of the Jquery object?
Basically, I would like to do something like this
if (WIN_COMBINATIONS[0].html = "X", "X", "X") {
//do something here
}
Thanks for your help!