The description and test in count-backwards-with-a-for-loop Spanish translation contains incoherent translations of reserved words (for / para), variable declarations (ourArray) and tests literals.
2.1 KiB
2.1 KiB
id, title, challengeType, videoUrl, localeTitle
| id | title | challengeType | videoUrl | localeTitle |
|---|---|---|---|---|
| 56105e7b514f539506016a5e | Count Backwards With a For Loop | 1 | Contar hacia atrás con un bucle for |
Description
initialization , condition y final-expression . Comenzaremos en i = 10 y haremos un bucle mientras i > 0 . Disminuiremos i en 2 cada bucle con i -= 2 . var ourArray = [];
for (var i = 10; i> 0; i- = 2) {
ourArray.push (i);
}
ourArray ahora contendrá [10,8,6,4,2] . Cambiemos nuestra initialization y final-expression para que podamos contar hacia atrás de dos en dos por números impares. Instructions
myArray usando un bucle for . Tests
tests:
- text: Usted debe estar usando un bucle <code>for</code> para esto.
testString: 'assert(code.match(/for\s*\(/g).length > 1, "Usted debe estar usando un bucle <code>for</code> para esto.");'
- text: Deberías estar usando el método de matriz <code>push</code>.
testString: 'assert(code.match(/myArray.push/), "Deberías estar usando el método de matriz <code>push</code>.");'
- text: '<code>myArray</code> debe ser igual a <code>[9,7,5,3,1]</code>.'
testString: 'assert.deepEqual(myArray, [9,7,5,3,1], "<code>myArray</code> debe ser igual a <code>[9,7,5,3,1]</code>.");'
Challenge Seed
// Example
var ourArray = [];
for (var i = 10; i > 0; i -= 2) {
ourArray.push(i);
}
// Setup
var myArray = [];
// Only change code below this line.
After Test
console.info('after the test');
Solution
// solution required