Basic JavaScript - Access Multi-Dimensional Arrays With Indexes

Tell us what’s happening:
i don’t understand the example attached to this test and how the element has the value of 11 , but i was somehow able to get the test right.

the example

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

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

Your code so far

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

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/117.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Access Multi-Dimensional Arrays With Indexes

Link to the challenge:

i went through the instructions once again, and i was able to understand that the first set of brackets refers to the entries in the outermost (the first level) array. the first bracket is [3], which the first level array did not possess, so that was a bit confusing

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.