Create complex multi-dimensional arrays fail

Create complex multi-dimensional arrays fail
0

#1

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


#2

No, you have created a 3-dimensional array. Your deepest level is 3. In fact you have three nested arrays at the same level ([“deep”], [“deeper”], and [“deepest”] are all nested in 2nd levels.


#3

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


#4

Inside one of the level three arrays I mentioned above.


#5

alright thanks I will give this a try.


#6

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


#7

Thanks man :slight_smile:


#8

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


#9

HINT: Remember, that array elements need to be separated by commas.


#10

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


#11

Not sure what you mean by duplicated.


#12

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.