freeCodeCamp/curriculum/challenges/russian/02-javascript-algorithms-an.../basic-javascript/iterate-with-javascript-whi...

63 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
id: cf1111c1c11feddfaeb1bdef
title: Iterate with JavaScript While Loops
challengeType: 1
videoUrl: ''
localeTitle: 'Итерации с помощью JavaScript, в то время как циклы'
---
## Description
<section id="description"> Вы можете запустить один и тот же код несколько раз, используя цикл. Первый тип цикла мы узнаем , что называется « в <code>while</code> » цикл , так как он работает « а» заданное условие истинно , и не остановится , как только это условие уже не так. <blockquote> var ourArray = []; <br> var i = 0; <br> тогда как (i &lt;5) { <br> ourArray.push (я); <br> я ++; <br> } </blockquote> Попробуем получить цикл while для работы, нажав значения в массив. </section>
## Instructions
<section id="instructions"> Нажмите цифры от 0 до 4 , чтобы <code>myArray</code> используя <code>while</code> цикл. </section>
## Tests
<section id='tests'>
```yml
tests:
- text: Вы должны использовать <code>while</code> петлю для этого.
testString: 'assert(code.match(/while/g), "You should be using a <code>while</code> loop for this.");'
- text: '<code>myArray</code> должен равняться <code>[0,1,2,3,4]</code> .'
testString: 'assert.deepEqual(myArray, [0,1,2,3,4], "<code>myArray</code> should equal <code>[0,1,2,3,4]</code>.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
// Setup
var myArray = [];
// Only change code below this line.
```
</div>
### After Test
<div id='js-teardown'>
```js
console.info('after the test');
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>