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

Popular posts from this blog

How to logout from a login page in asp.net -

Stack level too deep error after upgrade to rails 3.2 and ruby 1.9.3 -