http://jsfiddle.net/dXL2v/ <----K i think thats the entire code the instructor gave us, most of the messy code inside the functions were done by me so yea..but question still remains the same, the conditions are returning false even when the values are identical.
these are a couple small snippets of a larger code im supposed to program for a tic tac toe game, its supposed to check to see if each row or col has 3 of the same images and if there is, then u display a message saying the current player has won... what im having trouble with is the "topRow[0] == player" condition is returning false so the others dont even get compared...the value of topRow[0] is set to the relative path of an image ("Images/x.gif")
i have two players, var PLAYER_X is set to "Images/x.gif" and PLAYER_O is "Images/o.gif" so according to the code above, i thought if i was player x and i already had 2 X's on the board, if i clicked on the board and it went through the code and found that for each slot in the topRow array there is the value "Images/x.gif" it would output the message saying player X won.. instead it outputs the wrong message... when i run firebug with a breakpoint and paste in the express "topRow[0] == player" its returning false.. i checked the values and i dont know if this is the problem or not but the values inside of the topRow array is appearing as "lmages/x.gif" while the value of player is appearing as "Images/x.gif" but ive checked all my spelling and the cases are the same so im stumped....
EDIT:
i added the checkCol function, sorry new to this stuff..the instructor defined all the functions and the parameters to be passed were supposed to make stuff work based on his program