So, I have an array that looks like this:
[ ["","",""], ["","",""], ["","",""] ]
How would I test it in javascript to see if, perhaps, the 1st index was filled with X's?
EX: [ ["X","X","X"], ["","",""], ["","",""] ]
I keep thinking I should do something like this, but it feels like there would be a quicker way...
var counter = 0,
win,
b = [ ["X","X","X"], ["","",""], ["","",""] ],
num = b[0].length;
for(var i=0; i<num; i++){
if(b[0][i]==="X"){ counter++; }
}
if(num===counter){ win=true; }