chore(i8n,learn): processed translations (#41350)
* chore(i8n,learn): processed translations * fix: restore deleted test * fix: revert casing change Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
This commit is contained in:
committed by
GitHub
parent
8e4ada8f2d
commit
aff0ea700d
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: a9bd25c716030ec90084d8a1
|
||||
title: Chunky Monkey
|
||||
title: Monito Trocitos
|
||||
challengeType: 5
|
||||
forumTopicId: 16005
|
||||
dashedName: chunky-monkey
|
||||
@ -8,11 +8,11 @@ dashedName: chunky-monkey
|
||||
|
||||
# --description--
|
||||
|
||||
Write a function that splits an array (first argument) into groups the length of `size` (second argument) and returns them as a two-dimensional array.
|
||||
Escribe una función que divida un arreglo (primer argumento) en grupos de la longitud `size` (segundo argumento) y los devuelva como un arreglo bidimensional.
|
||||
|
||||
# --hints--
|
||||
|
||||
`chunkArrayInGroups(["a", "b", "c", "d"], 2)` should return `[["a", "b"], ["c", "d"]]`.
|
||||
`chunkArrayInGroups(["a", "b", "c", "d"], 2)` debe devolver `[["a", "b"], ["c", "d"]]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(chunkArrayInGroups(['a', 'b', 'c', 'd'], 2), [
|
||||
@ -21,7 +21,7 @@ assert.deepEqual(chunkArrayInGroups(['a', 'b', 'c', 'd'], 2), [
|
||||
]);
|
||||
```
|
||||
|
||||
`chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3)` should return `[[0, 1, 2], [3, 4, 5]]`.
|
||||
`chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3)` debe devolver `[[0, 1, 2], [3, 4, 5]]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3), [
|
||||
@ -30,7 +30,7 @@ assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3), [
|
||||
]);
|
||||
```
|
||||
|
||||
`chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2)` should return `[[0, 1], [2, 3], [4, 5]]`.
|
||||
`chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2)` debe devolver `[[0, 1], [2, 3], [4, 5]]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2), [
|
||||
@ -40,7 +40,7 @@ assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2), [
|
||||
]);
|
||||
```
|
||||
|
||||
`chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4)` should return `[[0, 1, 2, 3], [4, 5]]`.
|
||||
`chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4)` debe devolver `[[0, 1, 2, 3], [4, 5]]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4), [
|
||||
@ -49,7 +49,7 @@ assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4), [
|
||||
]);
|
||||
```
|
||||
|
||||
`chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3)` should return `[[0, 1, 2], [3, 4, 5], [6]]`.
|
||||
`chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3)` debe devolver `[[0, 1, 2], [3, 4, 5], [6]]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3), [
|
||||
@ -59,7 +59,7 @@ assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3), [
|
||||
]);
|
||||
```
|
||||
|
||||
`chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4)` should return `[[0, 1, 2, 3], [4, 5, 6, 7], [8]]`.
|
||||
`chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4)` debe devolver `[[0, 1, 2, 3], [4, 5, 6, 7], [8]]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4), [
|
||||
@ -69,7 +69,7 @@ assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4), [
|
||||
]);
|
||||
```
|
||||
|
||||
`chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2)` should return `[[0, 1], [2, 3], [4, 5], [6, 7], [8]]`.
|
||||
`chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2)` debe devolver `[[0, 1], [2, 3], [4, 5], [6, 7], [8]]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2), [
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 56533eb9ac21ba0edf2244b3
|
||||
title: Convert Celsius to Fahrenheit
|
||||
title: Convierte Celsius a Fahrenheit
|
||||
challengeType: 1
|
||||
forumTopicId: 16806
|
||||
dashedName: convert-celsius-to-fahrenheit
|
||||
@ -8,43 +8,43 @@ dashedName: convert-celsius-to-fahrenheit
|
||||
|
||||
# --description--
|
||||
|
||||
The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times `9/5`, plus `32`.
|
||||
El algoritmo para convertir de Celsius a Fahrenheit es la temperatura en Celsius multiplicado por `9/5`, más `32`.
|
||||
|
||||
You are given a variable `celsius` representing a temperature in Celsius. Use the variable `fahrenheit` already defined and assign it the Fahrenheit temperature equivalent to the given Celsius temperature. Use the algorithm mentioned above to help convert the Celsius temperature to Fahrenheit.
|
||||
Se te da una variable `celsius` que representa una temperatura en Celsius. Utiliza la variable `fahrenheit` ya definida y asígnale la temperatura Fahrenheit equivalente a la temperatura Celsius dada. Utiliza el algoritmo mencionado arriba para ayudar a convertir la temperatura en Celsius a Fahrenheit.
|
||||
|
||||
# --hints--
|
||||
|
||||
`convertToF(0)` should return a number
|
||||
`convertToF(0)` debe devolver un número
|
||||
|
||||
```js
|
||||
assert(typeof convertToF(0) === 'number');
|
||||
```
|
||||
|
||||
`convertToF(-30)` should return a value of `-22`
|
||||
`convertToF(-30)` debe devolver un valor de `-22`
|
||||
|
||||
```js
|
||||
assert(convertToF(-30) === -22);
|
||||
```
|
||||
|
||||
`convertToF(-10)` should return a value of `14`
|
||||
`convertToF(-10)` debe devolver un valor de `14`
|
||||
|
||||
```js
|
||||
assert(convertToF(-10) === 14);
|
||||
```
|
||||
|
||||
`convertToF(0)` should return a value of `32`
|
||||
`convertToF(0)` debe devolver un valor de `32`
|
||||
|
||||
```js
|
||||
assert(convertToF(0) === 32);
|
||||
```
|
||||
|
||||
`convertToF(20)` should return a value of `68`
|
||||
`convertToF(20)` debe devolver un valor de `68`
|
||||
|
||||
```js
|
||||
assert(convertToF(20) === 68);
|
||||
```
|
||||
|
||||
`convertToF(30)` should return a value of `86`
|
||||
`convertToF(30)` debe devolver un valor de `86`
|
||||
|
||||
```js
|
||||
assert(convertToF(30) === 86);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: adf08ec01beb4f99fc7a68f2
|
||||
title: Falsy Bouncer
|
||||
title: Rebote falsy
|
||||
challengeType: 5
|
||||
forumTopicId: 16014
|
||||
dashedName: falsy-bouncer
|
||||
@ -8,33 +8,33 @@ dashedName: falsy-bouncer
|
||||
|
||||
# --description--
|
||||
|
||||
Remove all falsy values from an array.
|
||||
Quita todos los valores falsos de un arreglo.
|
||||
|
||||
Falsy values in JavaScript are `false`, `null`, `0`, `""`, `undefined`, and `NaN`.
|
||||
Los valores falsos en JavaScript son `false`, `null`, `0`, `""`, `undefined` y `NaN`.
|
||||
|
||||
Hint: Try converting each value to a Boolean.
|
||||
Sugerencia: Intenta convertir cada valor a booleano.
|
||||
|
||||
# --hints--
|
||||
|
||||
`bouncer([7, "ate", "", false, 9])` should return `[7, "ate", 9]`.
|
||||
`bouncer([7, "ate", "", false, 9])` debe devolver `[7, "ate", 9]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(bouncer([7, 'ate', '', false, 9]), [7, 'ate', 9]);
|
||||
```
|
||||
|
||||
`bouncer(["a", "b", "c"])` should return `["a", "b", "c"]`.
|
||||
`bouncer(["a", "b", "c"])` debe devolver `["a", "b", "c"]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(bouncer(['a', 'b', 'c']), ['a', 'b', 'c']);
|
||||
```
|
||||
|
||||
`bouncer([false, null, 0, NaN, undefined, ""])` should return `[]`.
|
||||
`bouncer([false, null, 0, NaN, undefined, ""])` debe devolver `[]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(bouncer([false, null, 0, NaN, undefined, '']), []);
|
||||
```
|
||||
|
||||
`bouncer([null, NaN, 1, 2, undefined])` should return `[1, 2]`.
|
||||
`bouncer([null, NaN, 1, 2, undefined])` debe devolver `[1, 2]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(bouncer([null, NaN, 1, 2, undefined]), [1, 2]);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: a789b3483989747d63b0e427
|
||||
title: Devolver los números mayores del arreglo
|
||||
title: Devuelve los números mayores en los arreglos
|
||||
challengeType: 5
|
||||
forumTopicId: 16042
|
||||
dashedName: return-largest-numbers-in-arrays
|
||||
@ -8,9 +8,9 @@ dashedName: return-largest-numbers-in-arrays
|
||||
|
||||
# --description--
|
||||
|
||||
Devuelve un arreglo que consista en el mayor número de cada sub-arreglo dada. Por simplicidad, el arreglo dado contendrá exactamente 4 sub-arreglos.
|
||||
Devuelve un arreglo que consista en el mayor número de cada sub-arreglo proporcionado. Por simplicidad, el arreglo dado contendrá exactamente 4 sub-arreglos.
|
||||
|
||||
Recuerde, usted puede iterar con cada arreglo con un simple bucle for, y acceder a cada miembro del arreglo con la sintaxis `arr[i]`.
|
||||
Recuerda, puedes iterar a través de un arreglo utilizando un simple bucle for, y acceder a cada miembro del arreglo con la sintaxis `arr[i]`.
|
||||
|
||||
# --hints--
|
||||
|
||||
@ -41,7 +41,7 @@ assert.deepEqual(
|
||||
);
|
||||
```
|
||||
|
||||
`largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]])` debe devolver`[9, 35, 97, 1000000]`.
|
||||
`largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]])` debe devolver `[9, 35, 97, 1000000]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(
|
||||
|
@ -18,7 +18,7 @@ Devuelve el arreglo resultante. Los arreglos de entrada deben permanecer iguales
|
||||
|
||||
# --hints--
|
||||
|
||||
`frankenSplice([1, 2, 3], [4, 5], 1)` debe devolver`[4, 1, 2, 3, 5]`.
|
||||
`frankenSplice([1, 2, 3], [4, 5], 1)` debe devolver `[4, 1, 2, 3, 5]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(frankenSplice([1, 2, 3], [4, 5], 1), [4, 1, 2, 3, 5]);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: a24c1a4622e3c05097f71d67
|
||||
title: Where do I Belong
|
||||
title: Dónde pertenezco
|
||||
challengeType: 5
|
||||
forumTopicId: 16094
|
||||
dashedName: where-do-i-belong
|
||||
@ -8,105 +8,105 @@ dashedName: where-do-i-belong
|
||||
|
||||
# --description--
|
||||
|
||||
Return the lowest index at which a value (second argument) should be inserted into an array (first argument) once it has been sorted. The returned value should be a number.
|
||||
Devuelve el índice mas bajo en el que un valor (segundo argumento) debe ser insertado en un arreglo (primer argumento) una vez que éste haya sido ordenado. El valor devuelto debe ser un número.
|
||||
|
||||
For example, `getIndexToIns([1,2,3,4], 1.5)` should return `1` because it is greater than `1` (index 0), but less than `2` (index 1).
|
||||
Por ejemplo, `getIndexToIns([1,2,3,4], 1.5)` debe devolver `1` por que este valor es más grande que `1` (índice 0), pero menor que `2` (índice 1).
|
||||
|
||||
Likewise, `getIndexToIns([20,3,5], 19)` should return `2` because once the array has been sorted it will look like `[3,5,20]` and `19` is less than `20` (index 2) and greater than `5` (index 1).
|
||||
De esta forma, `getIndexToIns([20,3,5], 19)` debe devolver `2` porque una vez ordenado el arreglo, éste se verá así `[3,5,20]` y `19` es menor que `20` (índice 2) y mayor que `5` (índice 1).
|
||||
|
||||
# --hints--
|
||||
|
||||
`getIndexToIns([10, 20, 30, 40, 50], 35)` should return `3`.
|
||||
`getIndexToIns([10, 20, 30, 40, 50], 35)` debe devolver `3`.
|
||||
|
||||
```js
|
||||
assert(getIndexToIns([10, 20, 30, 40, 50], 35) === 3);
|
||||
```
|
||||
|
||||
`getIndexToIns([10, 20, 30, 40, 50], 35)` should return a number.
|
||||
`getIndexToIns([10, 20, 30, 40, 50], 35)` debe devolver un número.
|
||||
|
||||
```js
|
||||
assert(typeof getIndexToIns([10, 20, 30, 40, 50], 35) === 'number');
|
||||
```
|
||||
|
||||
`getIndexToIns([10, 20, 30, 40, 50], 30)` should return `2`.
|
||||
`getIndexToIns([10, 20, 30, 40, 50], 30)` debe devolver `2`.
|
||||
|
||||
```js
|
||||
assert(getIndexToIns([10, 20, 30, 40, 50], 30) === 2);
|
||||
```
|
||||
|
||||
`getIndexToIns([10, 20, 30, 40, 50], 30)` should return a number.
|
||||
`getIndexToIns([10, 20, 30, 40, 50], 30)` debe devolver un número.
|
||||
|
||||
```js
|
||||
assert(typeof getIndexToIns([10, 20, 30, 40, 50], 30) === 'number');
|
||||
```
|
||||
|
||||
`getIndexToIns([40, 60], 50)` should return `1`.
|
||||
`getIndexToIns([40, 60], 50)` debe devolver `1`.
|
||||
|
||||
```js
|
||||
assert(getIndexToIns([40, 60], 50) === 1);
|
||||
```
|
||||
|
||||
`getIndexToIns([40, 60], 50)` should return a number.
|
||||
`getIndexToIns([40, 60], 50)` debe devolver un número.
|
||||
|
||||
```js
|
||||
assert(typeof getIndexToIns([40, 60], 50) === 'number');
|
||||
```
|
||||
|
||||
`getIndexToIns([3, 10, 5], 3)` should return `0`.
|
||||
`getIndexToIns([3, 10, 5], 3)` debe devolver `0`.
|
||||
|
||||
```js
|
||||
assert(getIndexToIns([3, 10, 5], 3) === 0);
|
||||
```
|
||||
|
||||
`getIndexToIns([3, 10, 5], 3)` should return a number.
|
||||
`getIndexToIns([3, 10, 5], 3)` debe devolver un número.
|
||||
|
||||
```js
|
||||
assert(typeof getIndexToIns([3, 10, 5], 3) === 'number');
|
||||
```
|
||||
|
||||
`getIndexToIns([5, 3, 20, 3], 5)` should return `2`.
|
||||
`getIndexToIns([5, 3, 20, 3], 5)` debe devolver `2`.
|
||||
|
||||
```js
|
||||
assert(getIndexToIns([5, 3, 20, 3], 5) === 2);
|
||||
```
|
||||
|
||||
`getIndexToIns([5, 3, 20, 3], 5)` should return a number.
|
||||
`getIndexToIns([5, 3, 20, 3], 5)` debe devolver un número.
|
||||
|
||||
```js
|
||||
assert(typeof getIndexToIns([5, 3, 20, 3], 5) === 'number');
|
||||
```
|
||||
|
||||
`getIndexToIns([2, 20, 10], 19)` should return `2`.
|
||||
`getIndexToIns([2, 20, 10], 19)` debe devolver `2`.
|
||||
|
||||
```js
|
||||
assert(getIndexToIns([2, 20, 10], 19) === 2);
|
||||
```
|
||||
|
||||
`getIndexToIns([2, 20, 10], 19)` should return a number.
|
||||
`getIndexToIns([2, 20, 10], 19)` debe devolver un número.
|
||||
|
||||
```js
|
||||
assert(typeof getIndexToIns([2, 20, 10], 19) === 'number');
|
||||
```
|
||||
|
||||
`getIndexToIns([2, 5, 10], 15)` should return `3`.
|
||||
`getIndexToIns([2, 5, 10], 15)` debe devolver `3`.
|
||||
|
||||
```js
|
||||
assert(getIndexToIns([2, 5, 10], 15) === 3);
|
||||
```
|
||||
|
||||
`getIndexToIns([2, 5, 10], 15)` should return a number.
|
||||
`getIndexToIns([2, 5, 10], 15)` debe devolver un número.
|
||||
|
||||
```js
|
||||
assert(typeof getIndexToIns([2, 5, 10], 15) === 'number');
|
||||
```
|
||||
|
||||
`getIndexToIns([], 1)` should return `0`.
|
||||
`getIndexToIns([], 1)` debe devolver `0`.
|
||||
|
||||
```js
|
||||
assert(getIndexToIns([], 1) === 0);
|
||||
```
|
||||
|
||||
`getIndexToIns([], 1)` should return a number.
|
||||
`getIndexToIns([], 1)` debe devolver un número.
|
||||
|
||||
```js
|
||||
assert(typeof getIndexToIns([], 1) === 'number');
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d7b7c367417b2b2512b1a
|
||||
title: Access Property Names with Bracket Notation
|
||||
title: Accede a los nombres de propiedad con la notación de corchetes
|
||||
challengeType: 1
|
||||
forumTopicId: 301150
|
||||
dashedName: access-property-names-with-bracket-notation
|
||||
@ -8,28 +8,28 @@ dashedName: access-property-names-with-bracket-notation
|
||||
|
||||
# --description--
|
||||
|
||||
In the first object challenge we mentioned the use of bracket notation as a way to access property values using the evaluation of a variable. For instance, imagine that our `foods` object is being used in a program for a supermarket cash register. We have some function that sets the `selectedFood` and we want to check our `foods` object for the presence of that food. This might look like:
|
||||
En el primer desafío de objetos mencionamos el uso de notación de corchetes como una manera de acceder a los valores de una propiedad mediante la evaluación de una variable. Por ejemplo, imagina que nuestro objeto `foods` está siendo usado en un programa para una caja registradora de supermercado. Tenemos una función que establece `selectedFood` y queremos revisar en nuestro objeto `foods` si ese alimento está presente. Esto podría verse así:
|
||||
|
||||
```js
|
||||
let selectedFood = getCurrentFood(scannedItem);
|
||||
let inventory = foods[selectedFood];
|
||||
```
|
||||
|
||||
This code will evaluate the value stored in the `selectedFood` variable and return the value of that key in the `foods` object, or `undefined` if it is not present. Bracket notation is very useful because sometimes object properties are not known before runtime or we need to access them in a more dynamic way.
|
||||
El código evaluará el valor almacenado en la variable `selectedFood` y devolverá el valor de esa clave en el objeto `foods`, o `undefined` si no está presente. La notación de corchetes es muy útil porque a veces no conocemos las propiedades de los objetos antes de la ejecución o necesitamos acceder a ellos de una manera más dinámica.
|
||||
|
||||
# --instructions--
|
||||
|
||||
We've defined a function, `checkInventory`, which receives a scanned item as an argument. Return the current value of the `scannedItem` key in the `foods` object. You can assume that only valid keys will be provided as an argument to `checkInventory`.
|
||||
Hemos definido una función, `checkInventory`, que recibe como argumento un elemento escaneado. Devuelve el valor actual de la clave `scannedItem` en el objeto `foods`. Puedes asumir que sólo se proporcionarán claves válidas como argumento a `checkInventory`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`checkInventory` should be a function.
|
||||
`checkInventory` debe ser una función.
|
||||
|
||||
```js
|
||||
assert.strictEqual(typeof checkInventory, 'function');
|
||||
```
|
||||
|
||||
The `foods` object should have only the following key-value pairs: `apples: 25`, `oranges: 32`, `plums: 28`, `bananas: 13`, `grapes: 35`, `strawberries: 27`.
|
||||
El objeto `foods` debe tener solo los siguientes pares clave-valor: `apples: 25`, `oranges: 32`, `plums: 28`, `bananas: 13`, `grapes: 35`, `strawberries: 27`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(foods, {
|
||||
@ -42,19 +42,19 @@ assert.deepEqual(foods, {
|
||||
});
|
||||
```
|
||||
|
||||
`checkInventory("apples")` should return `25`.
|
||||
`checkInventory("apples")` debe devolver `25`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(checkInventory('apples'), 25);
|
||||
```
|
||||
|
||||
`checkInventory("bananas")` should return `13`.
|
||||
`checkInventory("bananas")` debe devolver `13`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(checkInventory('bananas'), 13);
|
||||
```
|
||||
|
||||
`checkInventory("strawberries")` should return `27`.
|
||||
`checkInventory("strawberries")` debe devolver `27`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(checkInventory('strawberries'), 27);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d7b7d367417b2b2512b1e
|
||||
title: Generar un arreglo de todas las claves de los objetos con Object.keys()
|
||||
title: Genera un arreglo de todas las claves de los objetos con Object.keys()
|
||||
challengeType: 1
|
||||
forumTopicId: 301160
|
||||
dashedName: generate-an-array-of-all-object-keys-with-object-keys
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d7b7d367417b2b2512b1f
|
||||
title: Modificar un arreglo almacenado en un objeto
|
||||
title: Modifica un arreglo almacenado en un objeto
|
||||
challengeType: 1
|
||||
forumTopicId: 301163
|
||||
dashedName: modify-an-array-stored-in-an-object
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d7b7c367417b2b2512b19
|
||||
title: Modify an Object Nested Within an Object
|
||||
title: Modifica un objeto anidado dentro de un objeto
|
||||
challengeType: 1
|
||||
forumTopicId: 301164
|
||||
dashedName: modify-an-object-nested-within-an-object
|
||||
@ -8,7 +8,7 @@ dashedName: modify-an-object-nested-within-an-object
|
||||
|
||||
# --description--
|
||||
|
||||
Now let's take a look at a slightly more complex object. Object properties can be nested to an arbitrary depth, and their values can be any type of data supported by JavaScript, including arrays and even other objects. Consider the following:
|
||||
Veamos ahora un objeto un poco más complejo. Las propiedades de los objetos pueden anidarse a una profundidad arbitraria, y sus valores pueden ser cualquier tipo de datos soportados por JavaScript, incluyendo arreglos e incluso otros objetos. Considera lo siguiente:
|
||||
|
||||
```js
|
||||
let nestedObject = {
|
||||
@ -26,7 +26,7 @@ let nestedObject = {
|
||||
};
|
||||
```
|
||||
|
||||
`nestedObject` has three properties: `id` (value is a number), `date` (value is a string), and `data` (value is an object with its nested structure). While structures can quickly become complex, we can still use the same notations to access the information we need. To assign the value `10` to the `busy` property of the nested `onlineStatus` object, we use dot notation to reference the property:
|
||||
`nestedObject` tiene tres propiedades: `id` (el valor es un número), `date` (el valor es una cadena), y `data` (el valor es un objeto con su estructura anidada). Aunque las estructuras pueden volverse rápidamente complejas, podemos seguir utilizando las mismas notaciones para acceder a la información que necesitamos. Para asignar el valor `10` a la propiedad `busy` del objeto anidado `onlineStatus`, utilizamos la notación de puntos para referenciar la propiedad:
|
||||
|
||||
```js
|
||||
nestedObject.data.onlineStatus.busy = 10;
|
||||
@ -34,11 +34,11 @@ nestedObject.data.onlineStatus.busy = 10;
|
||||
|
||||
# --instructions--
|
||||
|
||||
Here we've defined an object `userActivity`, which includes another object nested within it. Set the value of the `online` key to `45`.
|
||||
Aquí hemos definido un objeto `userActivity`, que incluye otro objeto anidado dentro de él. Establece el valor de la clave `online` en `45`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`userActivity` should have `id`, `date` and `data` properties.
|
||||
`userActivity` debe tener las propiedades `id`, `date` y `data`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -46,19 +46,19 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
`userActivity` should have a `data` key set to an object with keys `totalUsers` and `online`.
|
||||
`userActivity` debe tener una clave `data` establecida en un objeto con las claves `totalUsers` y `online`.
|
||||
|
||||
```js
|
||||
assert('totalUsers' in userActivity.data && 'online' in userActivity.data);
|
||||
```
|
||||
|
||||
The `online` property nested in the `data` key of `userActivity` should be set to `45`
|
||||
La propiedad `online` anidada en la clave `data` de `userActivity` debe establecerse en `45`
|
||||
|
||||
```js
|
||||
assert(userActivity.data.online === 45);
|
||||
```
|
||||
|
||||
The `online` property should be set using dot or bracket notation.
|
||||
La propiedad `online` debe establecerse utilizando la notación de puntos o corchetes.
|
||||
|
||||
```js
|
||||
assert.strictEqual(code.search(/online: 45/), -1);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d7b7c367417b2b2512b1b
|
||||
title: Use the delete Keyword to Remove Object Properties
|
||||
title: Usa la palabra clave "delete" para eliminar las propiedades de los objetos
|
||||
challengeType: 1
|
||||
forumTopicId: 301168
|
||||
dashedName: use-the-delete-keyword-to-remove-object-properties
|
||||
@ -8,11 +8,11 @@ dashedName: use-the-delete-keyword-to-remove-object-properties
|
||||
|
||||
# --description--
|
||||
|
||||
Now you know what objects are and their basic features and advantages. In short, they are key-value stores which provide a flexible, intuitive way to structure data, ***and***, they provide very fast lookup time. Throughout the rest of these challenges, we will describe several common operations you can perform on objects so you can become comfortable applying these useful data structures in your programs.
|
||||
Ahora ya sabes qué son los objetos y sus características y ventajas básicas. En resumen, son almacenes clave-valor que proporcionan una forma flexible e intuitiva de estructurar los datos, ***y***, proporcionan un tiempo de búsqueda muy rápido. A lo largo del resto de estos desafíos, describiremos varias operaciones comúnes que puedes realizar sobre los objetos para que te sientas cómodo aplicando estas útiles estructuras de datos en tus programas.
|
||||
|
||||
In earlier challenges, we have both added to and modified an object's key-value pairs. Here we will see how we can *remove* a key-value pair from an object.
|
||||
En desafíos anteriores, hemos agregado y modificado los pares clave-valor de un objeto. Aquí veremos cómo podemos *eliminar* un par clave-valor de un objeto.
|
||||
|
||||
Let's revisit our `foods` object example one last time. If we wanted to remove the `apples` key, we can remove it by using the `delete` keyword like this:
|
||||
Volvamos a nuestro ejemplo del objeto `foods` una última vez. Si quisiéramos eliminar la clave `apples`, podemos eliminarla utilizando la palabra clave `delete` de esta manera:
|
||||
|
||||
```js
|
||||
delete foods.apples;
|
||||
@ -20,11 +20,11 @@ delete foods.apples;
|
||||
|
||||
# --instructions--
|
||||
|
||||
Use the delete keyword to remove the `oranges`, `plums`, and `strawberries` keys from the `foods` object.
|
||||
Usa la palabra clave delete para eliminar las claves `oranges`, `plums` y `strawberries` del objeto `foods`.
|
||||
|
||||
# --hints--
|
||||
|
||||
The `foods` object should only have three keys: `apples`, `grapes`, and `bananas`.
|
||||
El objeto `foods` sólo debe tener tres claves: `apples`, `grapes` y `bananas`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -35,7 +35,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
The `oranges`, `plums`, and `strawberries` keys should be removed using `delete`.
|
||||
Las claves `oranges`, `plums` y `strawberries` deben ser eliminadas usando `delete`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 56104e9e514f539506016a5c
|
||||
title: Iterate Odd Numbers With a For Loop
|
||||
title: Itera números impares con un bucle "for"
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/cm8n7T9'
|
||||
forumTopicId: 18212
|
||||
@ -9,9 +9,9 @@ dashedName: iterate-odd-numbers-with-a-for-loop
|
||||
|
||||
# --description--
|
||||
|
||||
For loops don't have to iterate one at a time. By changing our `final-expression`, we can count by even numbers.
|
||||
Los bucles "for" no tienen que iterar de uno en uno a la vez. Al cambiar nuestra `final-expression` (expresión final), podemos contar con números pares.
|
||||
|
||||
We'll start at `i = 0` and loop while `i < 10`. We'll increment `i` by 2 each loop with `i += 2`.
|
||||
Empezaremos en `i = 0` y realizaremos el bucle mientras `i < 10`. Incrementaremos `i` en 2 cada bucle utilizando `i += 2`.
|
||||
|
||||
```js
|
||||
var ourArray = [];
|
||||
@ -20,21 +20,21 @@ for (var i = 0; i < 10; i += 2) {
|
||||
}
|
||||
```
|
||||
|
||||
`ourArray` will now contain `[0,2,4,6,8]`. Let's change our `initialization` so we can count by odd numbers.
|
||||
`ourArray` ahora contendrá `[0,2,4,6,8]`. Cambiemos nuestra `initialization` (inicialización) para que podamos contar por números impares.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Push the odd numbers from 1 through 9 to `myArray` using a `for` loop.
|
||||
Inserta los números impares desde 1 hasta 9 en `myArray` utilizando un bucle `for`.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should be using a `for` loop for this.
|
||||
Debes utilizar un bucle `for` para esto.
|
||||
|
||||
```js
|
||||
assert(/for\s*\([^)]+?\)/.test(code));
|
||||
```
|
||||
|
||||
`myArray` should equal `[1,3,5,7,9]`.
|
||||
`myArray` debe ser igual a `[1,3,5,7,9]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(myArray, [1, 3, 5, 7, 9]);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5675e877dbd60be8ad28edc6
|
||||
title: Iterate Through an Array with a For Loop
|
||||
title: Itera a través de un arreglo con un bucle "for"
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/caeR3HB'
|
||||
forumTopicId: 18216
|
||||
@ -9,7 +9,7 @@ dashedName: iterate-through-an-array-with-a-for-loop
|
||||
|
||||
# --description--
|
||||
|
||||
A common task in JavaScript is to iterate through the contents of an array. One way to do that is with a `for` loop. This code will output each element of the array `arr` to the console:
|
||||
Una tarea común en JavaScript es iterar a través del contenido de un arreglo. Una forma de hacerlo es con un bucle `for`. Este código mostrará cada elemento del arreglo `arr` en la consola:
|
||||
|
||||
```js
|
||||
var arr = [10, 9, 8, 7, 6];
|
||||
@ -18,33 +18,33 @@ for (var i = 0; i < arr.length; i++) {
|
||||
}
|
||||
```
|
||||
|
||||
Remember that arrays have zero-based indexing, which means the last index of the array is `length - 1`. Our condition for this loop is `i < arr.length`, which stops the loop when `i` is equal to `length`. In this case the last iteration is `i === 4` i.e. when `i` becomes equal to `arr.length` and outputs `6` to the console.
|
||||
Recuerda que los arreglos tienen una indexación basada en cero, lo que significa que el último índice del arreglo es igual a su longitud menos uno (`length - 1`). Nuestra condición para este bucle es `i < arr.length`, que detiene el bucle cuando `i` es igual a `length`. En este caso la última iteración es `i === 4`, es decir, cuando `i` es igual a `arr.length` e imprime `6` en la consola.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Declare and initialize a variable `total` to `0`. Use a `for` loop to add the value of each element of the `myArr` array to `total`.
|
||||
Declara e inicializa una variable `total` a `0`. Usa un bucle `for` para sumar el valor de cada elemento del arreglo `myArr` al `total`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`total` should be declared and initialized to 0.
|
||||
`total` debe declararse e inicializarse a 0.
|
||||
|
||||
```js
|
||||
assert(code.match(/(var|let|const)\s*?total\s*=\s*0.*?;?/));
|
||||
```
|
||||
|
||||
`total` should equal 20.
|
||||
`total` debe ser igual a 20.
|
||||
|
||||
```js
|
||||
assert(total === 20);
|
||||
```
|
||||
|
||||
You should use a `for` loop to iterate through `myArr`.
|
||||
Debes usar un bucle `for` para iterar a través de `myArr`.
|
||||
|
||||
```js
|
||||
assert(/for\s*\(/g.test(code) && /myArr\s*\[/g.test(code));
|
||||
```
|
||||
|
||||
You should not attempt to directly assign the value 20 to `total`.
|
||||
No debes intentar asignar directamente el valor 20 al `total`.
|
||||
|
||||
```js
|
||||
assert(!__helpers.removeWhiteSpace(code).match(/total[=+-]0*[1-9]+/gm));
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5a2efd662fb457916e1fe604
|
||||
title: Iterate with JavaScript Do...While Loops
|
||||
title: Itera con el bucle "do...while" de JavaScript
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/cDqWGcp'
|
||||
forumTopicId: 301172
|
||||
@ -9,7 +9,7 @@ dashedName: iterate-with-javascript-do---while-loops
|
||||
|
||||
# --description--
|
||||
|
||||
The next type of loop you will learn is called a `do...while` loop. It is called a `do...while` loop because it will first `do` one pass of the code inside the loop no matter what, and then continue to run the loop `while` the specified condition evaluates to `true`.
|
||||
El siguiente tipo de bucle que aprenderás se llama bucle `do...while`. Se llama bucle `do...while` porque primero hace (`do`) una pasada por el código dentro del bucle sin importar qué, y luego continua ejecutando el bucle mientras (`while`) la condición especificada sea verdadera (`true`).
|
||||
|
||||
```js
|
||||
var ourArray = [];
|
||||
@ -20,7 +20,7 @@ do {
|
||||
} while (i < 5);
|
||||
```
|
||||
|
||||
The example above behaves similar to other types of loops, and the resulting array will look like `[0, 1, 2, 3, 4]`. However, what makes the `do...while` different from other loops is how it behaves when the condition fails on the first check. Let's see this in action: Here is a regular `while` loop that will run the code in the loop as long as `i < 5`:
|
||||
El ejemplo anterior se comporta de forma similar a otros tipos de bucles, siendo el arreglo resultante `[0, 1, 2, 3, 4]`. Sin embargo, lo que hace que el bucle `do...while` sea diferente a otros bucles es cómo se comporta cuando la condición falla en la primera verificación. Veamos esto en acción: Aquí puedes ver un bucle `while` que ejecutará el código una y otra vez siempre que `i < 5`:
|
||||
|
||||
```js
|
||||
var ourArray = [];
|
||||
@ -31,7 +31,7 @@ while (i < 5) {
|
||||
}
|
||||
```
|
||||
|
||||
In this example, we initialize the value of `ourArray` to an empty array and the value of `i` to 5. When we execute the `while` loop, the condition evaluates to `false` because `i` is not less than 5, so we do not execute the code inside the loop. The result is that `ourArray` will end up with no values added to it, and it will still look like `[]` when all of the code in the example above has completed running. Now, take a look at a `do...while` loop:
|
||||
En este ejemplo, inicializamos el valor de `ourArray` a un arreglo vacío y el valor de `i` a 5. Cuando ejecutamos el bucle `while`, la condición se evalúa como `false` porque `i` no es inferior a 5, así que no ejecutamos el código dentro del bucle. El resultado es que `ourArray` terminará sin valores añadidos, y todavía se verá como `[]` una vez el código del ejemplo anterior haya terminado de ejecutarse. Ahora, dale un vistazo a un bucle `do...while`:
|
||||
|
||||
```js
|
||||
var ourArray = [];
|
||||
@ -42,27 +42,27 @@ do {
|
||||
} while (i < 5);
|
||||
```
|
||||
|
||||
In this case, we initialize the value of `i` to 5, just like we did with the `while` loop. When we get to the next line, there is no condition to evaluate, so we go to the code inside the curly braces and execute it. We will add a single element to the array and then increment `i` before we get to the condition check. When we finally evaluate the condition `i < 5` on the last line, we see that `i` is now 6, which fails the conditional check, so we exit the loop and are done. At the end of the above example, the value of `ourArray` is `[5]`. Essentially, a `do...while` loop ensures that the code inside the loop will run at least once. Let's try getting a `do...while` loop to work by pushing values to an array.
|
||||
En este caso, inicializamos el valor de `i` a 5, tal como lo hicimos en el bucle `while`. Cuando lleguemos a la siguiente línea, no hay ninguna condición para evaluar, así que entramos al código dentro de las llaves y se ejecuta. Añadiremos un único elemento al arreglo y luego incrementaremos `i` antes de llegar a la verificación de la condición. Cuando finalmente evaluamos la condición `i < 5` en la última línea, vemos que el valor de `i` es ahora 6, por lo que falla la comprobación condicional. Salimos del bucle y hemos terminado. Al final del ejemplo anterior, el valor de `ourArray` es `[5]`. Esencialmente, un bucle `do...while` asegura que el código dentro del bucle se ejecute al menos una vez. Intentemos construir un bucle `do...while` para que funcione empujando valores a un arreglo.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Change the `while` loop in the code to a `do...while` loop so the loop will push only the number `10` to `myArray`, and `i` will be equal to `11` when your code has finished running.
|
||||
Cambia el bucle `while` en el código por un bucle `do...while`. El bucle solo enviará el número `10` a `myArray`, e `i` será igual a `11` cuando tu código haya terminado de ejecutarse.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should be using a `do...while` loop for this exercise.
|
||||
Debes utilizar el bucle `do...while` para este ejercicio.
|
||||
|
||||
```js
|
||||
assert(code.match(/do/g));
|
||||
```
|
||||
|
||||
`myArray` should equal `[10]`.
|
||||
`myArray` debe ser igual a `[10]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(myArray, [10]);
|
||||
```
|
||||
|
||||
`i` should equal `11`
|
||||
`i` debe ser igual a `11`
|
||||
|
||||
```js
|
||||
assert.equal(i, 11);
|
||||
|
@ -10,7 +10,7 @@ dashedName: prevent-infinite-loops-with-a-valid-terminal-condition
|
||||
|
||||
El último tema es el temido bucle infinito. Los bucles son una gran herramienta cuando necesitas que tu programa ejecute un bloque de código un determinado número de veces o hasta que se cumpla una condición, pero necesitan una condición terminal para que finalice el bucle. Los bucles infinitos pueden congelar o bloquear el navegador, y causar un caos en la ejecución del programa en general, lo que nadie quiere.
|
||||
|
||||
Había un ejemplo de un bucle infinito en la introducción de esta sección - no tenía ninguna condición terminal para salir del bucle `while` dentro de `loopy()`. ¡NO llames a esta función!
|
||||
Había un ejemplo de un bucle infinito en la introducción de esta sección - no tenía ninguna condición terminal para salir del bucle `while` dentro de `loopy()`. ¡NO llames esta función!
|
||||
|
||||
```js
|
||||
function loopy() {
|
||||
|
Reference in New Issue
Block a user