Create complex multi-dimensional arrays fail

Tell us what’s happening:
Hi Guys , on this challenge - i have to create a multi dimensional array 5 levels deep. On the 3rd level I have to have a array with a string called “deep”, 4th level “deeper”, 5th level "deepest.

I pass with the 3rd level, but failing on the array being 5 levels deeps, and failing on level 4 and 5 of the array having deeper, and deepest in the nested array. See my code, to me this is a 5 level array, as it goes 5 levels deep, can you help me understand and point me in the right direction please

Your code so far
let myNestedArray = [
// change code below this line
[
‘unshift’, false, 1, 2, 3, ‘complex’, ‘nested’
],
[
‘loop’, ‘shift’, 6, 7, 1000, ‘method’
],
[
‘concat’, false, true, ‘spread’, ‘array’, [“deep”]
],
[
‘mutate’, 1327.98, ‘splice’, ‘slice’, ‘push’,[“deeper”]
],
[
‘iterate’, 1.3849, 7, ‘8.4876’, ‘arbitrary’,[“deepest”]
],

// change code above this line
];


let myNestedArray = [
  // change code below this line
  [
    'unshift', false, 1, 2, 3, 'complex', 'nested'
  ],
  [
    'loop', 'shift', 6, 7, 1000, 'method'
  ],
  [
    'concat', false, true, 'spread', 'array', ["deep"]
  ],
  [
    'mutate', 1327.98, 'splice', 'slice', 'push',["deeper"]
  ],
  [
    'iterate', 1.3849, 7, '8.4876', 'arbitrary',["deepest"]
  ],


  // change code above this line
];

Your browser information:

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

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

how would i got one level deeper? where would i create a new array ?

Inside one of the level three arrays I mentioned above.

alright thanks I will give this a try.

I passed with this:

let myNestedArray = [
// change code below this line
[[[[“deepest”],“deeper”], “deep”]]
// change code above this line

];
console.log(myNestedArray[0][0][0][0][0]);

Thanks man :slight_smile:

Hi,
I don’t really understand why it doesn’t work. Could you look at this please

let myNestedArray = [

  ['unshift', false, 1, 2, 3, 'complex', 'nested'],
  ['loop', 'shift', 6, 7, 1000, 'method'],

  ['concat', false, true, 'spread', 'array',['deep'['deeper'['deepest']]]]

  ['mutate', 1327.98, 'splice', 'slice', 'push'],
  ['iterate', 1.3849, 7, '8.4876', 'arbitrary', 'depth']

];

console.log (myNestedArray[2][5][0][0][0]);

I am curious, why is the “let myNestedArray” is duplicated in this challenge?

Thanks for this. I had to stare at your code longer than I care to admit to realize that everything between the commented lines is ALREADY level 1 of the array.

1 Like

let myNestedArray = [
// change code below this line
[‘unshift’, false, 1, 2, 3, ‘complex’, ‘nested’],
[‘loop’, ‘shift’, 6, 7, 1000, ‘method’],
[‘concat’, false, true, ‘spread’, ‘array’, [‘deep’]],
[‘mutate’, 1327.98,true, ‘slice’, ‘push’, [[‘deeper’]]],
[‘iterate’, 1.3849, 7, false, ‘arbitrary’, ‘depth’, [[[‘deepest’]]]]
// change code above this line
];