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

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -