Wednesday, 27 November 2019

How do i declare two dimensional arrays in javascript?

could you not just do something like this?


var x = new Array(4);             #1st array, array of arrays
y = new Array(1, 4, 2, 0); #2nd dimension of arrays, an array of values
z = new Array(4, 8, 3, 9); #^^^
a = new Array(7, 0, 2, 4); #^^^
t = new Array(9, 0, 3, 1); #^^^

then to access 7 (the 1st value) in array a (3) you could type:


var example = x.3.1

if this wont work please tell me cos this is what i was told and what im now using to program my game

No comments:

Post a Comment