Tell us what’s happening:
This is actually the example problem.I’m not able to wrap my head over [2][1][0][0][0]
Can someone tell me what each index represents in the given code?
Because when i tried it out, i was able to get deepest-est with just [2][1]. so why even mention [0][0][0]?
Your code so far
let nestedArray = [ // top, or first level - the outer most array
['deep'], // an array within an array, 2 levels of depth
[
['deeper'], ['deeper'] // 2 arrays nested 3 levels deep
],
[
[
['deepest'], ['deepest'] // 2 arrays nested 4 levels deep
],
[
[
['deepest-est?'] // an array nested 5 levels deep
]
]
]
];
console.log(nestedArray[2][1][0][0][0]);
// logs: deepest-est?
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays