Accessing Multidimensional arrays with nested indexes?

Accessing Multidimensional arrays with nested indexes?
0.0 0

#1
// Setup
var myArray = [[1,2,3], [4,5,6], [7,8,9], [[10,11,12], 13, 14]];

// Only change code below this line.
var myData = myArray[0][0];

anyone here can help out on this? I’ve tried but i can seem to use bracket notation to read values from myArray…


#2

To access values you need to understand the indexing, in your case it’s like that:
…[0]…[1]…[2]…[3]…
var myArray = [[1,2,3], [4,5,6], [7,8,9], [[10,11,12], 13, 14]];
…[0]…[1]…[2]

So to access say 11 you have to:

var myData = myArray[3][0][1];

W


#3

thanks very much… i understand now…


#4

var myData = myArray[2][1];


#5

a tip i wrote down was to remember “Zero-Indexing” so therefore the first bracket would be 0, the next bracket would be 1, next bracket would be 2, etc etc…


#6

This image is so helpful. Thank you


#7

what does the number below indicate