71 lines
985 B
Markdown
71 lines
985 B
Markdown
---
|
|
id: 5a2efd662fb457916e1fe604
|
|
title: Iterate with JavaScript Do...While Loops
|
|
challengeType: 1
|
|
videoUrl: ''
|
|
localeTitle: ''
|
|
---
|
|
|
|
## Description
|
|
undefined
|
|
|
|
## Instructions
|
|
undefined
|
|
|
|
## Tests
|
|
<section id='tests'>
|
|
|
|
```yml
|
|
tests:
|
|
- text: ''
|
|
testString: 'assert(code.match(/do/g), "You should be using a <code>do...while</code> loop for this.");'
|
|
- text: ''
|
|
testString: 'assert.deepEqual(myArray, [10], "<code>myArray</code> should equal <code>[10]</code>.");'
|
|
- text: ''
|
|
testString: 'assert.deepEqual(i, 11, "<code>i</code> should equal <code>11</code>");'
|
|
|
|
```
|
|
|
|
</section>
|
|
|
|
## Challenge Seed
|
|
<section id='challengeSeed'>
|
|
|
|
<div id='js-seed'>
|
|
|
|
```js
|
|
// Setup
|
|
var myArray = [];
|
|
var i = 10;
|
|
|
|
// Only change code below this line.
|
|
|
|
while (i < 5) {
|
|
myArray.push(i);
|
|
i++;
|
|
}
|
|
|
|
```
|
|
|
|
</div>
|
|
|
|
|
|
### After Test
|
|
<div id='js-teardown'>
|
|
|
|
```js
|
|
console.info('after the test');
|
|
```
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
## Solution
|
|
<section id='solution'>
|
|
|
|
```js
|
|
// solution required
|
|
```
|
|
</section>
|