# Basic Data Structures - Create complex multi-dimensional arrays

Tell us what’s happening:
I am not able to get hold of this challenge what exactly is this asking for.

``````let myNestedArray = [
// Only change code below this line
['unshift', false, 1, 2, 3, 'complex', 'nested'],
['loop', 'shift', 6, 7, 1000, 'method'],
['mutate', 1327.98, 'splice', 'slice', 'push'],
['iterate', 1.3849, 7, '8.4876', 'arbitrary', 'depth']
// Only change code above this line
];
``````

User Agent is: `Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36`

Challenge: Basic Data Structures - Create complex multi-dimensional arrays

Welcome to our community!

Your task is to re-order the sub-arrays in a way that `myNestedArray` array contains elements on different levels. For example, if an array is three levels deep you will have the following:

``````let myArr = [ ...the first level
[the second level],
[[ the third level ]],
]
``````

If you put the square brackets around the sub-arrays in a way as the example in the instructions, you will get the same structure as shown above. In that way, it is easier to recognize different levels.

Each level should have a different but exact string. Re-read the instructions.

1 Like

Welcome to the forums! This challenge is asking you to add layers of depth to an array. For reference, when you embed more arrays into an array, you keep adding more depth.

For example, let’s say I have this array:

``````let depthArray = [
['deep']
];
``````

The `depthArray` has 2 levels of depth because there is the upper array (where I set it equal to a pair of brackets creating the initial array). And then I put another array inside of that one, and this one has the string `deep` in it.

The reason why we say it has a depth of 2 is because if I wanted to see what the string was at the 2nd depth at a certain index, I would need to use 2 references to get to it:

``````console.log('depthArray at depth 2 index 0 has the following value: ', depthArray[0][0]);
``````

Notice I had to use two sets of brackets to get to that 2nd layer.

This pattern repeats itself no matter the layer of depth.

Now, all you need to do is to apply that methodology to create the depths that the challenge asks for.

1 Like

Thank you for the clarification. much appreciate it.

1 Like

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