--- id: 56104e9e514f539506016a5c title: Iterate Odd Numbers With a For Loop challengeType: 1 videoUrl: '' localeTitle: Iterar números impares con un bucle for --- ## Description
Para que los bucles no tengan que iterar uno a la vez. Al cambiar nuestra final-expression , podemos contar por números pares. Comenzaremos en i = 0 y haremos un bucle mientras i < 10 . Incrementaremos i en 2 en cada bucle con i += 2 .
var ourArray = [];
para (var i = 0; i <10; i + = 2) {
nuestroArray.push (i);
}
ourArray ahora contendrá [0,2,4,6,8] . Cambiemos nuestra initialization para que podamos contar por números impares.
## Instructions
Empuje los números impares del 1 al 9 a myArray usando un bucle for .
## Tests
```yml tests: - text: Usted debe estar usando una for bucle para esto. testString: 'assert(code.match(/for\s*\(/g).length > 1, "You should be using a for loop for this.");' - text: 'myArray debe ser igual a [1,3,5,7,9] .' testString: 'assert.deepEqual(myArray, [1,3,5,7,9], "myArray should equal [1,3,5,7,9].");' ```
## Challenge Seed
```js // Example var ourArray = []; for (var i = 0; i < 10; i += 2) { ourArray.push(i); } // Setup var myArray = []; // Only change code below this line. ```
### After Test
```js console.info('after the test'); ```
## Solution
```js // solution required ```