* fix: remove example code from challenge seed * fix: remove declaration from solution * fix: added sum variable back in * fix: reverted description back to original version * fix: added examples to description section * fix: added complete sentence Co-Authored-By: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> * fix: corrected typo Co-Authored-By: Manish Giri <manish.giri.me@gmail.com> * fix: reverted to original desc with formatted code * fix: removed unnecessary code example from description section Co-Authored-By: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> * fix: failiing test on iterate through array with for loop * fix: changed to Only change this line Co-Authored-By: Manish Giri <manish.giri.me@gmail.com> Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> Co-authored-by: Manish Giri <manish.giri.me@gmail.com> Co-authored-by: moT01 <tmondloch01@gmail.com>
71 lines
1.1 KiB
Markdown
71 lines
1.1 KiB
Markdown
---
|
|
id: cf1111c1c11feddfaeb7bdef
|
|
title: Nest one Array within Another Array
|
|
challengeType: 1
|
|
videoUrl: 'https://scrimba.com/c/crZQZf8'
|
|
forumTopicId: 18247
|
|
---
|
|
|
|
## Description
|
|
<section id='description'>
|
|
You can also nest arrays within other arrays, like below:
|
|
|
|
```js
|
|
[["Bulls", 23], ["White Sox", 45]]
|
|
```
|
|
|
|
This is also called a <dfn>multi-dimensional array<dfn>.
|
|
</section>
|
|
|
|
## Instructions
|
|
<section id='instructions'>
|
|
Create a nested array called <code>myArray</code>.
|
|
</section>
|
|
|
|
## Tests
|
|
<section id='tests'>
|
|
|
|
```yml
|
|
tests:
|
|
- text: <code>myArray</code> should have at least one array nested within another array.
|
|
testString: assert(Array.isArray(myArray) && myArray.some(Array.isArray));
|
|
|
|
```
|
|
|
|
</section>
|
|
|
|
## Challenge Seed
|
|
<section id='challengeSeed'>
|
|
|
|
<div id='js-seed'>
|
|
|
|
```js
|
|
// Only change code below this line
|
|
var myArray = [];
|
|
|
|
```
|
|
|
|
</div>
|
|
|
|
|
|
### After Test
|
|
<div id='js-teardown'>
|
|
|
|
```js
|
|
if(typeof myArray !== "undefined"){(function(){return myArray;})();}
|
|
```
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
## Solution
|
|
<section id='solution'>
|
|
|
|
|
|
```js
|
|
var myArray = [[1,2,3]];
|
|
```
|
|
|
|
</section>
|