I have an array
cells = [0, 0, 0, 0, 0, 0, 0, 0, 0];
which is updated with a jQuery function
$(document).ready(function(){
...
$('#box').click(function(e){
var indexArray = e.target.id.split('_');
if (indexArray.length > 1) {
var index = indexArray[1];
if (cells[index] == 0){
cells[index] = move;
...
})
I want to make a cross-check of cells array groups. for example:
(cells[0] + cells[1] + cells[2]); // row 1
(cells[3] + cells[4] + cells[5]); // row 2
(cells[6] + cells[7] + cells[8]); // row 3
...
I tried to create a multidimensional array, but all I get is undefined:
var triggers = [[cells[0], cells[1], cells[2]]];
is it possible to pass cells arrays' variables to triggers array? Can't figure it out?!