Tell us what’s happening:
Example:
In this example, subarray
has the value [[10, 11, 12], 13, 14]
, nestedSubarray
has the value [10, 11, 12]
, and element
has the value 11
.
To clear my understanding the example in this stage is wrong, as nestedSubarray
should’ve an element
of 10
because of the zero-indexing.
Your code so far
const arr = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
[[10, 11, 12], 13, 14]
];
const subarray = arr[3];
const nestedSubarray = arr[3][0];
const element = arr[3][0][1];
const 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/113.0.0.0 Safari/537.36
Challenge: Basic JavaScript - Access Multi-Dimensional Arrays With Indexes
Link to the challenge: