Access Multi-Dimensional Arrays With Indexes - error?

Tell us what’s happening:
In the given example:

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

it says that

arr[3][0][1]; // equals 11

but when I tried to write

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

for the challenge, it wasn’t accepted. It was accepted until I wrote

var myData = myArray[2][1];

I don’t know what’s wrong with it.

Your code so far


// 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[2][1];

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes

myArray[2] does not have an array inside of it. myArray [3] does.

2 Likes

arr[2] = [7, 8, 9]
arr[2][0] = 7
So,
arr[2] [1] = ?

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

so how much is 3+5? and which numbers do we need
if you know that you can fill in the two 0 0