# Acces Multi-Dimensional Arrays With Indexes

Acces Multi-Dimensional Arrays With Indexes
0

#1

Tell us what’s happening:

``````
// 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];

myData = 7 + 1;
myArray = [1,2,3], [4,5,6], [7,8,9], [[10,11,12], 13, 14];
``````

#2

There is no need for you to re-assign a new array to myArray varaible. So you can safely remove the last line.

Make sure you are reading the example given carefully… Remember the first doesn’t index start at 1 but it starts at 0.

``````var arr = [
[1,2,3],
[4,5,6],
[7,8,9],
[[10,11,12], 13, 14]
];
arr[3]; // equals [[10,11,12], 13, 14]
arr[3][0]; // equals [10,11,12]
arr[3][0][1]; // equals 11
``````

#3

Thanks i figred it out
[2][1] put me on the 8

#4

How did you do it i cant seem to get it i used

added myData which is the same as yours but i cant get the myArray.

#5

Post you code, maybe we can spot the error.

#6

i just got it…All i done was add [2][1]. within the myArray so it can add up but i still need to understand it though…guess i just need practice.

#7

Don’t worry, practice is something that we all need. And even with all the practice, sometimes things slip. Good luck!

#8

It’s quite simple: you already know the counting starts from 0 and not 1. All you need to do is just to read the example al-over and compare it with this code.

``````myData = myArray[2][1];
``````

From the above code, the [2] is to access the box where we have 8 i.e `[7,8,9]` and since the number 8 is the 2nd but “programmatically” 1st, just access it by `[1]` so you have the above code.

Give it a like if it helped.