Array in javascript not working in the right way? -
i have strange problem , should solved in less 1 minute. can't understand why not working.
i have bidimensional array "gridship" , i'm doing stuff array.
this code:
gridship[i][j].stat = "ship"; gridship[i][j+1].stat = "ship"; gridship[i][j-1].stat = "ship";
after print in console 3 cell of array.
the first working, third 1 no! have no errors , check if don't out of array size.
make no sense me.
that works me
var i=0; j=1; var gridship = []; gridship[i] = [{},{},{}]; gridship[i][j].stat = "ship"; gridship[i][j+1].stat = "ship"; gridship[i][j-1].stat = "ship";
tell more details.
Comments
Post a Comment