melascuco 15da2cf118 Fix partial Spanish translations (#26069)
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.
2019-03-08 12:31:34 +01:00

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

Un bucle for también puede contar hacia atrás, siempre que podamos definir las condiciones correctas. Para contar hacia atrás de dos en dos, necesitaremos cambiar nuestra 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

Empuje los números impares del 9 al 1 a 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