2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								id: 587d7b7b367417b2b2512b16
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								title: Create complex multi-dimensional arrays
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								challengeType: 1
							 
						 
					
						
							
								
									
										
										
										
											2019-08-05 09:17:33 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								forumTopicId: 301159
							 
						 
					
						
							
								
									
										
										
										
											2021-01-13 03:31:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								dashedName: create-complex-multi-dimensional-arrays
							 
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# --description--
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								Awesome! You have just learned a ton about arrays! This has been a fairly high level overview, and there is plenty more to learn about working with arrays, much of which you will see in later sections. But before moving on to looking at < dfn > Objects< / dfn > , lets take one more look, and see how arrays can become a bit more complex than what we have seen in previous challenges.
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								One of the most powerful features when thinking of arrays as data structures, is that arrays can contain, or even be completely made up of other arrays. We have seen arrays that contain arrays in previous challenges, but fairly simple ones. However, arrays can contain an infinite depth of arrays that can contain other arrays, each with their own arbitrary levels of depth, and so on. In this way, an array can very quickly become very complex data structure, known as a < dfn > multi-dimensional< / dfn > , or nested array. Consider the following example:
							 
						 
					
						
							
								
									
										
										
										
											2019-04-26 17:21:49 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-05-01 09:33:02 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
									
										
										
										
											2021-03-02 16:12:12 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								let nestedArray = [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  ['deep'],
							 
						 
					
						
							
								
									
										
										
										
											2019-04-26 17:21:49 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  [
							 
						 
					
						
							
								
									
										
										
										
											2021-03-02 16:12:12 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ['deeper'], ['deeper'] 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-26 17:21:49 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    [
							 
						 
					
						
							
								
									
										
										
										
											2021-03-02 16:12:12 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      ['deepest'], ['deepest']
							 
						 
					
						
							
								
									
										
										
										
											2019-04-26 17:21:49 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      [
							 
						 
					
						
							
								
									
										
										
										
											2021-03-02 16:12:12 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        ['deepest-est?']
							 
						 
					
						
							
								
									
										
										
										
											2019-04-26 17:21:49 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								];
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-02 16:12:12 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The `deep`  array is nested 2 levels deep. The `deeper`  arrays are 3 levels deep. The `deepest`  arrays are 4 levels, and the `deepest-est?`  is 5.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								While this example may seem convoluted, this level of complexity is not unheard of, or even unusual, when dealing with large amounts of data. However, we can still very easily access the deepest levels of an array this complex with bracket notation:
							 
						 
					
						
							
								
									
										
										
										
											2019-04-26 17:21:49 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-05-01 09:33:02 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
									
										
										
										
											2019-04-26 17:21:49 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								console.log(nestedArray[2][1][0][0][0]);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-02 16:12:12 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								This logs the string `deepest-est?` . And now that we know where that piece of data is, we can reset it if we need to:
							 
						 
					
						
							
								
									
										
										
										
											2019-04-26 17:21:49 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-05-01 09:33:02 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
									
										
										
										
											2019-04-26 17:21:49 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								nestedArray[2][1][0][0][0] = 'deeper still';
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								console.log(nestedArray[2][1][0][0][0]);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-02 16:12:12 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Now it logs `deeper still` .
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# --instructions--
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-02 16:12:12 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								We have defined a variable, `myNestedArray` , set equal to an array. Modify `myNestedArray` , using any combination of < dfn > strings</ dfn > , < dfn > numbers</ dfn > , and < dfn > booleans</ dfn >  for data elements, so that it has exactly five levels of depth (remember, the outer-most array is level 1). Somewhere on the third level, include the string `deep` , on the fourth level, include the string `deeper` , and on the fifth level, include the string `deepest` .
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# --hints--
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								`myNestedArray`  should contain only numbers, booleans, and strings as data elements 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								assert.strictEqual(
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  (function (arr) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    let flattened = (function flatten(arr) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      const flat = [].concat(...arr);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      return flat.some(Array.isArray) ? flatten(flat) : flat;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    })(arr);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for (let i = 0; i <  flattened.length ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      if (
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        typeof flattened[i] !== 'number' & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        typeof flattened[i] !== 'string' & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        typeof flattened[i] !== 'boolean'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return false;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return true;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  })(myNestedArray),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  true
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								`myNestedArray`  should have exactly 5 levels of depth 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								assert.strictEqual(
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  (function (arr) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    let depth = 0;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    function arrayDepth(array, i, d) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      if (Array.isArray(array[i])) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        arrayDepth(array[i], 0, d + 1);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } else {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        depth = d > depth ? d : depth;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      if (i <  array.length )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        arrayDepth(array, i + 1, d);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    arrayDepth(arr, 0, 0);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return depth;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  })(myNestedArray),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  4
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-02 16:12:12 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								`myNestedArray`  should contain exactly one occurrence of the string `deep`  on an array nested 3 levels deep 
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								assert(
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  (function howDeep(array, target, depth = 0) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return array.reduce((combined, current) => {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      if (Array.isArray(current)) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return combined.concat(howDeep(current, target, depth + 1));
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } else if (current === target) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return combined.concat(depth);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } else {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return combined;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }, []);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  })(myNestedArray, 'deep').length === 1 & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    (function howDeep(array, target, depth = 0) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      return array.reduce((combined, current) => {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if (Array.isArray(current)) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          return combined.concat(howDeep(current, target, depth + 1));
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } else if (current === target) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          return combined.concat(depth);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } else {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          return combined;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      }, []);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    })(myNestedArray, 'deep')[0] === 2
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								);
							 
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-02 16:12:12 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								`myNestedArray`  should contain exactly one occurrence of the string `deeper`  on an array nested 4 levels deep 
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								assert(
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  (function howDeep(array, target, depth = 0) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return array.reduce((combined, current) => {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      if (Array.isArray(current)) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return combined.concat(howDeep(current, target, depth + 1));
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } else if (current === target) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return combined.concat(depth);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } else {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return combined;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }, []);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  })(myNestedArray, 'deeper').length === 1 & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    (function howDeep(array, target, depth = 0) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      return array.reduce((combined, current) => {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if (Array.isArray(current)) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          return combined.concat(howDeep(current, target, depth + 1));
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } else if (current === target) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          return combined.concat(depth);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } else {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          return combined;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      }, []);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    })(myNestedArray, 'deeper')[0] === 3
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-02 16:12:12 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								`myNestedArray`  should contain exactly one occurrence of the string `deepest`  on an array nested 5 levels deep 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								assert(
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  (function howDeep(array, target, depth = 0) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return array.reduce((combined, current) => {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      if (Array.isArray(current)) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return combined.concat(howDeep(current, target, depth + 1));
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } else if (current === target) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return combined.concat(depth);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } else {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return combined;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }, []);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  })(myNestedArray, 'deepest').length === 1 & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    (function howDeep(array, target, depth = 0) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      return array.reduce((combined, current) => {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if (Array.isArray(current)) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          return combined.concat(howDeep(current, target, depth + 1));
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } else if (current === target) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          return combined.concat(depth);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } else {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          return combined;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      }, []);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    })(myNestedArray, 'deepest')[0] === 4
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# --seed--
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## --seed-contents--
  
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								let myNestedArray = [
							 
						 
					
						
							
								
									
										
										
										
											2020-03-02 23:18:30 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  // Only change code below this line
							 
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  ['unshift', false, 1, 2, 3, 'complex', 'nested'],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  ['loop', 'shift', 6, 7, 1000, 'method'],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  ['concat', false, true, 'spread', 'array'],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  ['mutate', 1327.98, 'splice', 'slice', 'push'],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  ['iterate', 1.3849, 7, '8.4876', 'arbitrary', 'depth']
							 
						 
					
						
							
								
									
										
										
										
											2020-03-02 23:18:30 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  // Only change code above this line
							 
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								];
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 19:02:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# --solutions--
  
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```js
							 
						 
					
						
							
								
									
										
										
										
											2019-04-10 08:33:15 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								let myNestedArray = [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  ['unshift', ['deep', ['deeper', ['deepest']]],false, 1, 2, 3, 'complex', 'nested'],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  ['loop', 'shift', 6, 7, 1000, 'method'],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  ['concat', false, true, 'spread', 'array'],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  ['mutate', 1327.98, 'splice', 'slice', 'push'],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  ['iterate', 1.3849, 7, '8.4876', 'arbitrary', 'depth']
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								];
							 
						 
					
						
							
								
									
										
										
										
											2018-09-30 23:01:58 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								```