chore(i18n,learn): processed translations (#41387)
* chore(i8n,learn): processed translations * fix: remove extra space Co-authored-by: Nicholas Carrigan (he/him) <nhcarrigan@gmail.com> Co-authored-by: Crowdin Bot <support+bot@crowdin.com> Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> Co-authored-by: Nicholas Carrigan (he/him) <nhcarrigan@gmail.com>
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: cf1111c1c11feddfaeb5bdef
|
||||
title: Iterate with JavaScript For Loops
|
||||
title: Itera con los bucles "for" de JavaScript
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/c9yNVCe'
|
||||
forumTopicId: 18219
|
||||
@ -9,21 +9,21 @@ dashedName: iterate-with-javascript-for-loops
|
||||
|
||||
# --description--
|
||||
|
||||
You can run the same code multiple times by using a loop.
|
||||
Puedes ejecutar el mismo código múltiples veces usando un bucle.
|
||||
|
||||
The most common type of JavaScript loop is called a `for` loop because it runs "for" a specific number of times.
|
||||
El tipo más común de bucle de JavaScript se llama bucle `for` porque se ejecuta "por" un número específico de veces.
|
||||
|
||||
For loops are declared with three optional expressions separated by semicolons:
|
||||
Los bucles for se declaran con tres expresiones opcionales separadas por punto y coma:
|
||||
|
||||
`for ([initialization]; [condition]; [final-expression])`
|
||||
`for (a; b; c)`, donde `a` es la sentencia de inicialización, `b` es la sentencia condicional, y `c` es la expresión final.
|
||||
|
||||
The `initialization` statement is executed one time only before the loop starts. It is typically used to define and setup your loop variable.
|
||||
La sentencia de inicialización se ejecuta una sola vez antes de que el bucle comience. Normalmente se utiliza para definir y configurar tu variable de bucle.
|
||||
|
||||
The `condition` statement is evaluated at the beginning of every loop iteration and will continue as long as it evaluates to `true`. When `condition` is `false` at the start of the iteration, the loop will stop executing. This means if `condition` starts as `false`, your loop will never execute.
|
||||
La sentencia condicional es evaluada al principio de cada iteración del bucle y continuará siempre y cuando sea `true`. Cuando la condición sea `false` al inicio de la iteración, el bucle dejará de ejecutarse. Esto significa que si la condición comienza como falso, tu bucle nunca se ejecutará.
|
||||
|
||||
The `final-expression` is executed at the end of each loop iteration, prior to the next `condition` check and is usually used to increment or decrement your loop counter.
|
||||
La expresión final se ejecuta al final de cada iteración del bucle, antes de la siguiente comprobación de condición y se utiliza normalmente para incrementar o disminuir tu contador de bucle.
|
||||
|
||||
In the following example we initialize with `i = 0` and iterate while our condition `i < 5` is true. We'll increment `i` by `1` in each loop iteration with `i++` as our `final-expression`.
|
||||
En el siguiente ejemplo inicializamos con `i = 0` e iteramos mientras nuestra condición `i < 5` es verdadera. Incrementaremos `i` por `1` en cada iteración de bucle con `i++` como nuestra expresión final.
|
||||
|
||||
```js
|
||||
var ourArray = [];
|
||||
@ -32,21 +32,21 @@ for (var i = 0; i < 5; i++) {
|
||||
}
|
||||
```
|
||||
|
||||
`ourArray` will now contain `[0,1,2,3,4]`.
|
||||
`ourArray` ahora tendrá el valor `[0,1,2,3,4]`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Use a `for` loop to work to push the values 1 through 5 onto `myArray`.
|
||||
Usa un bucle `for` para empujar los valores desde el 1 al 5 en `myArray`.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should be using a `for` loop for this.
|
||||
Debes usar un bucle `for` para esto.
|
||||
|
||||
```js
|
||||
assert(/for\s*\([^)]+?\)/.test(code));
|
||||
```
|
||||
|
||||
`myArray` should equal `[1,2,3,4,5]`.
|
||||
`myArray` debe ser igual a `[1,2,3,4,5]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(myArray, [1, 2, 3, 4, 5]);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: cf1111c1c11feddfaeb1bdef
|
||||
title: Iterate with JavaScript While Loops
|
||||
title: Itera con el bucle "while" de JavaScript
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/c8QbnCM'
|
||||
forumTopicId: 18220
|
||||
@ -9,9 +9,9 @@ dashedName: iterate-with-javascript-while-loops
|
||||
|
||||
# --description--
|
||||
|
||||
You can run the same code multiple times by using a loop.
|
||||
Puedes ejecutar el mismo código múltiples veces usando un bucle.
|
||||
|
||||
The first type of loop we will learn is called a `while` loop because it runs "while" a specified condition is true and stops once that condition is no longer true.
|
||||
El primer tipo de bucle que aprenderemos se llama bucle `while` porque ejecuta una condición específica mientras esta sea verdadera, y se detiene una vez que esa condición ya no sea verdadera.
|
||||
|
||||
```js
|
||||
var ourArray = [];
|
||||
@ -22,23 +22,23 @@ while(i < 5) {
|
||||
}
|
||||
```
|
||||
|
||||
In the code example above, the `while` loop will execute 5 times and append the numbers 0 through 4 to `ourArray`.
|
||||
En el ejemplo de código anterior, el bucle `while` se ejecutará 5 veces y añadirá los números de 0 a 4 a `ourArray`.
|
||||
|
||||
Let's try getting a while loop to work by pushing values to an array.
|
||||
Intentemos construir un bucle while para que funcione empujando valores a un arreglo.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Add the numbers 5 through 0 (inclusive) in descending order to `myArray` using a `while` loop.
|
||||
Agrega los números de 5 a 0 (inclusivo) en orden descendente a `myArray` usando un bucle `while`.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should be using a `while` loop for this.
|
||||
Debes utilizar un bucle `while` para esto.
|
||||
|
||||
```js
|
||||
assert(code.match(/while/g));
|
||||
```
|
||||
|
||||
`myArray` should equal `[5,4,3,2,1,0]`.
|
||||
`myArray` debe ser igual a `[5,4,3,2,1,0]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(myArray, [5, 4, 3, 2, 1, 0]);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 56533eb9ac21ba0edf2244bf
|
||||
title: Local Scope and Functions
|
||||
title: Ámbito local y funciones
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/cd62NhM'
|
||||
forumTopicId: 18227
|
||||
@ -9,30 +9,30 @@ dashedName: local-scope-and-functions
|
||||
|
||||
# --description--
|
||||
|
||||
Variables which are declared within a function, as well as the function parameters have <dfn>local</dfn> scope. That means, they are only visible within that function.
|
||||
Las variables que se declaran dentro de una función, así como los parámetros de la función tienen un ámbito <dfn>local</dfn>. Esto significa que sólo son visibles dentro de esa función.
|
||||
|
||||
Here is a function `myTest` with a local variable called `loc`.
|
||||
Esta es una función `myTest` con una variable local llamada `loc`.
|
||||
|
||||
```js
|
||||
function myTest() {
|
||||
var loc = "foo";
|
||||
console.log(loc);
|
||||
}
|
||||
myTest(); // logs "foo"
|
||||
console.log(loc); // loc is not defined
|
||||
myTest();
|
||||
console.log(loc);
|
||||
```
|
||||
|
||||
`loc` is not defined outside of the function.
|
||||
La llamada a la función `myTest()` mostrará la cadena `foo` en la consola. La línea `console.log(loc)` arrojará un error, ya que `loc` no está definida fuera de la función.
|
||||
|
||||
# --instructions--
|
||||
|
||||
The editor has two `console.log`s to help you see what is happening. Check the console as you code to see how it changes. Declare a local variable `myVar` inside `myLocalScope` and run the tests.
|
||||
El editor tiene dos `console.log`s para ayudarte a ver lo que está sucediendo. Revisa la consola a medida que programas para ver cómo cambia. Declara una variable local `myVar` dentro de `myLocalScope` y ejecuta las pruebas.
|
||||
|
||||
**Note:** The console will still have 'ReferenceError: myVar is not defined', but this will not cause the tests to fail.
|
||||
**Nota:** La consola todavía mostrará el error `ReferenceError: myVar is not defined`, pero esto no causará que las pruebas fallen.
|
||||
|
||||
# --hints--
|
||||
|
||||
The code should not contain a global `myVar` variable.
|
||||
El código no debe contener una variable global `myVar`.
|
||||
|
||||
```js
|
||||
function declared() {
|
||||
@ -41,7 +41,7 @@ function declared() {
|
||||
assert.throws(declared, ReferenceError);
|
||||
```
|
||||
|
||||
You should add a local `myVar` variable.
|
||||
Debes agregar una variable local `myVar`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5690307fddb111c6084545d7
|
||||
title: Logical Order in If Else Statements
|
||||
title: Orden lógico de las sentencias "if else"
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/cwNvMUV'
|
||||
forumTopicId: 18228
|
||||
@ -9,13 +9,13 @@ dashedName: logical-order-in-if-else-statements
|
||||
|
||||
# --description--
|
||||
|
||||
Order is important in `if`, `else if` statements.
|
||||
El orden es importante en las sentencias `if`, `else if`.
|
||||
|
||||
The function is executed from top to bottom so you will want to be careful of what statement comes first.
|
||||
La función se ejecuta de arriba a abajo, por lo que habrá que tener cuidado con qué sentencia va primero.
|
||||
|
||||
Take these two functions as an example.
|
||||
Tomemos como ejemplo estas dos funciones.
|
||||
|
||||
Here's the first:
|
||||
Aquí está la primera:
|
||||
|
||||
```js
|
||||
function foo(x) {
|
||||
@ -29,7 +29,7 @@ function foo(x) {
|
||||
}
|
||||
```
|
||||
|
||||
And the second just switches the order of the statements:
|
||||
Y la segunda, simplemente cambia el orden de las sentencias:
|
||||
|
||||
```js
|
||||
function bar(x) {
|
||||
@ -43,32 +43,34 @@ function bar(x) {
|
||||
}
|
||||
```
|
||||
|
||||
While these two functions look nearly identical if we pass a number to both we get different outputs.
|
||||
Mientras que estas dos funciones parecen casi idénticas, si pasamos un número a ambas, obtenemos diferentes salidas.
|
||||
|
||||
```js
|
||||
foo(0) // "Less than one"
|
||||
bar(0) // "Less than two"
|
||||
foo(0)
|
||||
bar(0)
|
||||
```
|
||||
|
||||
`foo(0)` devolverá la cadena `Less than one`, y `bar(0)` devolverá la cadena `Less than two`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Change the order of logic in the function so that it will return the correct statements in all cases.
|
||||
Cambia el orden lógico en la función para que devuelva el resultado correcto en todos los casos.
|
||||
|
||||
# --hints--
|
||||
|
||||
`orderMyLogic(4)` should return "Less than 5"
|
||||
`orderMyLogic(4)` debe devolver la cadena `Less than 5`
|
||||
|
||||
```js
|
||||
assert(orderMyLogic(4) === 'Less than 5');
|
||||
```
|
||||
|
||||
`orderMyLogic(6)` should return "Less than 10"
|
||||
`orderMyLogic(6)` debe devolver la cadena `Less than 10`
|
||||
|
||||
```js
|
||||
assert(orderMyLogic(6) === 'Less than 10');
|
||||
```
|
||||
|
||||
`orderMyLogic(11)` should return "Greater than or equal to 10"
|
||||
`orderMyLogic(11)` debe devolver la cadena `Greater than or equal to 10`
|
||||
|
||||
```js
|
||||
assert(orderMyLogic(11) === 'Greater than or equal to 10');
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 56bbb991ad1ed5201cd392cc
|
||||
title: Manipulate Arrays With pop()
|
||||
title: Manipula arreglos con pop()
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/cRbVZAB'
|
||||
forumTopicId: 18236
|
||||
@ -9,26 +9,28 @@ dashedName: manipulate-arrays-with-pop
|
||||
|
||||
# --description--
|
||||
|
||||
Another way to change the data in an array is with the `.pop()` function.
|
||||
Otra manera de cambiar los datos en un arreglo es con la función `.pop()`.
|
||||
|
||||
`.pop()` is used to "pop" a value off of the end of an array. We can store this "popped off" value by assigning it to a variable. In other words, `.pop()` removes the last element from an array and returns that element.
|
||||
`.pop()` se utiliza para sacar un valor del final de un arreglo. Podemos almacenar este valor sacado asignándolo a una variable. En otras palabras, `.pop()` elimina el último elemento de un arreglo y devuelve ese elemento.
|
||||
|
||||
Any type of entry can be "popped" off of an array - numbers, strings, even nested arrays.
|
||||
Cualquier tipo de entrada puede ser sacada de un arreglo: números, cadenas, incluso arreglos anidados.
|
||||
|
||||
```js
|
||||
var threeArr = [1, 4, 6];
|
||||
var oneDown = threeArr.pop();
|
||||
console.log(oneDown); // Returns 6
|
||||
console.log(threeArr); // Returns [1, 4]
|
||||
console.log(oneDown);
|
||||
console.log(threeArr);
|
||||
```
|
||||
|
||||
El primer `console.log` mostrará el valor `6` y el segundo mostrará el valor `[1, 4]`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Use the `.pop()` function to remove the last item from `myArray`, assigning the "popped off" value to `removedFromMyArray`.
|
||||
Utiliza la función `.pop()` para eliminar el último elemento de `myArray`, asignando el valor sacado a `removedFromMyArray`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`myArray` should only contain `[["John", 23]]`.
|
||||
`myArray` sólo debe contener `[["John", 23]]`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -42,13 +44,13 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
You should use `pop()` on `myArray`.
|
||||
Debes usar `pop()` en `myArray`.
|
||||
|
||||
```js
|
||||
assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code));
|
||||
```
|
||||
|
||||
`removedFromMyArray` should only contain `["cat", 2]`.
|
||||
`removedFromMyArray` sólo debe contener `["cat", 2]`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 56bbb991ad1ed5201cd392cb
|
||||
title: Manipulate Arrays With push()
|
||||
title: Manipula arreglos con push()
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/cnqmVtJ'
|
||||
forumTopicId: 18237
|
||||
@ -9,29 +9,29 @@ dashedName: manipulate-arrays-with-push
|
||||
|
||||
# --description--
|
||||
|
||||
An easy way to append data to the end of an array is via the `push()` function.
|
||||
Una forma fácil de añadir datos al final de un arreglo es a través de la función `push()`.
|
||||
|
||||
`.push()` takes one or more <dfn>parameters</dfn> and "pushes" them onto the end of the array.
|
||||
`.push()` toma uno o más <dfn>parámetros</dfn> y los "empuja" al final del arreglo.
|
||||
|
||||
Examples:
|
||||
Ejemplos:
|
||||
|
||||
```js
|
||||
var arr1 = [1,2,3];
|
||||
arr1.push(4);
|
||||
// arr1 is now [1,2,3,4]
|
||||
|
||||
var arr2 = ["Stimpson", "J", "cat"];
|
||||
arr2.push(["happy", "joy"]);
|
||||
// arr2 now equals ["Stimpson", "J", "cat", ["happy", "joy"]]
|
||||
```
|
||||
|
||||
`arr1` ahora tiene el valor `[1, 2, 3, 4]` y `arr2` tiene el valor `["Stimpson", "J", "cat", ["happy", "joy"]]`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Push `["dog", 3]` onto the end of the `myArray` variable.
|
||||
Empuja `["dog", 3]` al final de la variable `myArray`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`myArray` should now equal `[["John", 23], ["cat", 2], ["dog", 3]]`.
|
||||
`myArray` debe ser igual a `[["John", 23], ["cat", 2], ["dog", 3]]`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 56bbb991ad1ed5201cd392cd
|
||||
title: Manipulate Arrays With shift()
|
||||
title: Manipula arreglos con shift()
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/cRbVETW'
|
||||
forumTopicId: 18238
|
||||
@ -9,25 +9,26 @@ dashedName: manipulate-arrays-with-shift
|
||||
|
||||
# --description--
|
||||
|
||||
`pop()` always removes the last element of an array. What if you want to remove the first?
|
||||
`pop()` siempre elimina el último elemento de un arreglo. ¿Qué tal si quieres eliminar el primero?
|
||||
|
||||
That's where `.shift()` comes in. It works just like `.pop()`, except it removes the first element instead of the last.
|
||||
Ahí es donde entra `.shift()`. Funciona igual que `.pop()`, excepto que elimina el primer elemento en lugar del último.
|
||||
|
||||
Example:
|
||||
Ejemplo:
|
||||
|
||||
```js
|
||||
var ourArray = ["Stimpson", "J", ["cat"]];
|
||||
var removedFromOurArray = ourArray.shift();
|
||||
// removedFromOurArray now equals "Stimpson" and ourArray now equals ["J", ["cat"]].
|
||||
```
|
||||
|
||||
`removedFromOurArray` tendrá una cadena con valor `Stimpson` y `ourArray` tendrá `["J", ["cat"]]`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Use the `.shift()` function to remove the first item from `myArray`, assigning the "shifted off" value to `removedFromMyArray`.
|
||||
Utiliza la función `.shift()` para eliminar el primer elemento de `myArray`, asignando el valor "desplazado" a `removedFromMyArray`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`myArray` should now equal `[["dog", 3]]`.
|
||||
`myArray` debe ser igual a `[["dog", 3]]`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -41,7 +42,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
`removedFromMyArray` should contain `["John", 23]`.
|
||||
`removedFromMyArray` debe contener `["John", 23]`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 56533eb9ac21ba0edf2244cb
|
||||
title: Manipulating Complex Objects
|
||||
title: Manipulando objectos complejos
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/c9yNMfR'
|
||||
forumTopicId: 18208
|
||||
@ -9,9 +9,9 @@ dashedName: manipulating-complex-objects
|
||||
|
||||
# --description--
|
||||
|
||||
Sometimes you may want to store data in a flexible <dfn>Data Structure</dfn>. A JavaScript object is one way to handle flexible data. They allow for arbitrary combinations of <dfn>strings</dfn>, <dfn>numbers</dfn>, <dfn>booleans</dfn>, <dfn>arrays</dfn>, <dfn>functions</dfn>, and <dfn>objects</dfn>.
|
||||
A veces, es posible que desees almacenar datos en una <dfn>estructura de datos</dfn> flexible. Un objeto de JavaScript es una forma de manejar datos flexibles. Permiten combinaciones arbitrarias de <dfn>cadenas</dfn>, <dfn>números</dfn>, <dfn>booleanos</dfn>, <dfn>arreglos</dfn>, <dfn>funciones</dfn>, y <dfn>objetos</dfn>.
|
||||
|
||||
Here's an example of a complex data structure:
|
||||
Este es un ejemplo de una estructura de datos compleja:
|
||||
|
||||
```js
|
||||
var ourMusic = [
|
||||
@ -29,7 +29,7 @@ var ourMusic = [
|
||||
];
|
||||
```
|
||||
|
||||
This is an array which contains one object inside. The object has various pieces of <dfn>metadata</dfn> about an album. It also has a nested `"formats"` array. If you want to add more album records, you can do this by adding records to the top level array. Objects hold data in a property, which has a key-value format. In the example above, `"artist": "Daft Punk"` is a property that has a key of `"artist"` and a value of `"Daft Punk"`. [JavaScript Object Notation](http://www.json.org/) or `JSON` is a related data interchange format used to store data.
|
||||
Esto es una arreglo que contiene un objeto en su interior. El objeto tiene varias piezas de <dfn>metadatos</dfn> sobre un álbum. También tiene un arreglo anidado de `formats`. Si desea añadir más registros de álbumes, puede hacerlo añadiendo registros a la parte superior del arreglo. Los objetos almacenan datos en una propiedad, con formato clave-valor. En el ejemplo anterior, `"artist": "Daft Punk"` es una propiedad que tiene como clave `artist` y su valor es `Daft Punk`. [JavaScript Object Notation](http://www.json.org/) o `JSON` es un formato de intercambio de datos relacionado utilizado para almacenar información.
|
||||
|
||||
```json
|
||||
{
|
||||
@ -45,40 +45,39 @@ This is an array which contains one object inside. The object has various pieces
|
||||
}
|
||||
```
|
||||
|
||||
**Note**
|
||||
You will need to place a comma after every object in the array, unless it is the last object in the array.
|
||||
**Nota:** Deberás colocar una coma después de cada objeto en el arreglo, a menos que sea el último objeto.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Add a new album to the `myMusic` array. Add `artist` and `title` strings, `release_year` number, and a `formats` array of strings.
|
||||
Añade un nuevo álbum al arreglo `myMusic`. Añade las cadenas `artist` y `title`, el número `release_year`, y un arreglo de cadenas `formats`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`myMusic` should be an array
|
||||
`myMusic` debe ser un arreglo
|
||||
|
||||
```js
|
||||
assert(Array.isArray(myMusic));
|
||||
```
|
||||
|
||||
`myMusic` should have at least two elements
|
||||
`myMusic` debe tener al menos dos elementos
|
||||
|
||||
```js
|
||||
assert(myMusic.length > 1);
|
||||
```
|
||||
|
||||
`myMusic[1]` should be an object
|
||||
`myMusic[1]` debe ser un objeto
|
||||
|
||||
```js
|
||||
assert(typeof myMusic[1] === 'object');
|
||||
```
|
||||
|
||||
`myMusic[1]` should have at least 4 properties
|
||||
`myMusic[1]` debe tener al menos 4 propiedades
|
||||
|
||||
```js
|
||||
assert(Object.keys(myMusic[1]).length > 3);
|
||||
```
|
||||
|
||||
`myMusic[1]` should contain an `artist` property which is a string
|
||||
`myMusic[1]` debe contener una propiedad `artist` que es una cadena
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -86,7 +85,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
`myMusic[1]` should contain a `title` property which is a string
|
||||
`myMusic[1]` debe contener una propiedad `title` que es una cadena
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -94,7 +93,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
`myMusic[1]` should contain a `release_year` property which is a number
|
||||
`myMusic[1]` debe contener una propiedad `release_year` que es un número
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -103,7 +102,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
`myMusic[1]` should contain a `formats` property which is an array
|
||||
`myMusic[1]` debe contener una propiedad `formats` que es un arreglo
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -111,7 +110,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
`formats` should be an array of strings with at least two elements
|
||||
`formats` debe ser un arreglo de cadenas con al menos dos elementos
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: cf1111c1c11feddfaeb8bdef
|
||||
title: Modify Array Data With Indexes
|
||||
title: Modifica los datos de un arreglo con índices
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/czQM4A8'
|
||||
forumTopicId: 18241
|
||||
@ -9,25 +9,26 @@ dashedName: modify-array-data-with-indexes
|
||||
|
||||
# --description--
|
||||
|
||||
Unlike strings, the entries of arrays are <dfn>mutable</dfn> and can be changed freely.
|
||||
A diferencia de las cadenas, las entradas de los arreglos son <dfn>mutables</dfn> y pueden cambiarse libremente.
|
||||
|
||||
**Example**
|
||||
**Ejemplo**
|
||||
|
||||
```js
|
||||
var ourArray = [50,40,30];
|
||||
ourArray[0] = 15; // equals [15,40,30]
|
||||
ourArray[0] = 15;
|
||||
```
|
||||
|
||||
**Note**
|
||||
There shouldn't be any spaces between the array name and the square brackets, like `array [0]`. Although JavaScript is able to process this correctly, this may confuse other programmers reading your code.
|
||||
`ourArray` ahora tiene el valor `[15, 40, 30]`.
|
||||
|
||||
**Nota:** No debe haber espacios entre el nombre del arreglo y los corchetes, como `array [0]`. Aunque JavaScript pueda procesar esto correctamente, puedes confundir a otros programadores al leer tu código.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Modify the data stored at index `0` of `myArray` to a value of `45`.
|
||||
Modifica los datos almacenados en el índice `0` de `myArray` a un valor de `45`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`myArray` should now be [45,64,99].
|
||||
`myArray` ahora debe ser `[45,64,99]`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -46,7 +47,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
You should be using correct index to modify the value in `myArray`.
|
||||
Debes usar el índice correcto para modificar el valor en `myArray`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: bd7993c9c69feddfaeb7bdef
|
||||
title: Multiply Two Decimals with JavaScript
|
||||
title: Multiplica dos números decimales con JavaScript
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/ce2GeHq'
|
||||
forumTopicId: 301173
|
||||
@ -9,23 +9,23 @@ dashedName: multiply-two-decimals-with-javascript
|
||||
|
||||
# --description--
|
||||
|
||||
In JavaScript, you can also perform calculations with decimal numbers, just like whole numbers.
|
||||
En JavaScript, también puedes realizar cálculos con números decimales, al igual que con números enteros.
|
||||
|
||||
Let's multiply two decimals together to get their product.
|
||||
Multipliquemos dos números decimales para obtener su producto.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Change the `0.0` so that product will equal `5.0`.
|
||||
Cambia el `0.0` para que el producto sea igual a `5.0`.
|
||||
|
||||
# --hints--
|
||||
|
||||
The variable `product` should equal `5.0`.
|
||||
La variable `product` debe ser igual a `5.0`.
|
||||
|
||||
```js
|
||||
assert(product === 5.0);
|
||||
```
|
||||
|
||||
You should use the `*` operator
|
||||
Debes utilizar el operador `*`
|
||||
|
||||
```js
|
||||
assert(/\*/.test(code));
|
||||
|
@ -16,9 +16,11 @@ JavaScript utiliza el símbolo `*` para multiplicar dos números.
|
||||
**Ejemplo**
|
||||
|
||||
```js
|
||||
myVar = 13 * 13; // assigned 169
|
||||
myVar = 13 * 13;
|
||||
```
|
||||
|
||||
`myVar` ahora tendrá el valor `169`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Cambia el `0` para que el producto sea igual a `80`.
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 56533eb9ac21ba0edf2244e1
|
||||
title: Nesting For Loops
|
||||
title: Anida bucles "for"
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/cRn6GHM'
|
||||
forumTopicId: 18248
|
||||
@ -9,7 +9,7 @@ dashedName: nesting-for-loops
|
||||
|
||||
# --description--
|
||||
|
||||
If you have a multi-dimensional array, you can use the same logic as the prior waypoint to loop through both the array and any sub-arrays. Here is an example:
|
||||
Si tienes un arreglo multidimensional, puedes utilizar la misma lógica que aprendimos anteriormente para recorrer tanto el arreglo como cualquier sub-arreglo. Aquí hay un ejemplo:
|
||||
|
||||
```js
|
||||
var arr = [
|
||||
@ -22,21 +22,21 @@ for (var i=0; i < arr.length; i++) {
|
||||
}
|
||||
```
|
||||
|
||||
This outputs each sub-element in `arr` one at a time. Note that for the inner loop, we are checking the `.length` of `arr[i]`, since `arr[i]` is itself an array.
|
||||
Esto imprime cada sub-elemento dentro de `arr` uno a la vez. Ten en cuenta que para el bucle interior, estamos comprobando el `.length` de `arr[i]`, ya que `arr[i]` es en sí mismo es un arreglo.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Modify function `multiplyAll` so that it returns the product of all the numbers in the sub-arrays of `arr`.
|
||||
Modifica la función `multiplyAll` para que devuelva el producto de todos los números dentro de los sub-arreglos de `arr`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`multiplyAll([[1],[2],[3]])` should return `6`
|
||||
`multiplyAll([[1],[2],[3]])` debe devolver `6`
|
||||
|
||||
```js
|
||||
assert(multiplyAll([[1], [2], [3]]) === 6);
|
||||
```
|
||||
|
||||
`multiplyAll([[1,2],[3,4],[5,6,7]])` should return `5040`
|
||||
`multiplyAll([[1,2],[3,4],[5,6,7]])` debe devolver `5040`
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -48,7 +48,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
`multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]])` should return `54`
|
||||
`multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]])` debe devolver `54`
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 56533eb9ac21ba0edf2244bd
|
||||
title: Passing Values to Functions with Arguments
|
||||
title: Pasa valores a las funciones utilizando argumentos
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/cy8rahW'
|
||||
forumTopicId: 18254
|
||||
@ -9,9 +9,9 @@ dashedName: passing-values-to-functions-with-arguments
|
||||
|
||||
# --description--
|
||||
|
||||
<dfn>Parameters</dfn> are variables that act as placeholders for the values that are to be input to a function when it is called. When a function is defined, it is typically defined along with one or more parameters. The actual values that are input (or <dfn>"passed"</dfn>) into a function when it is called are known as <dfn>arguments</dfn>.
|
||||
<dfn>Los parámetros</dfn> son variables que actúan como marcadores de posición para los valores que deben ser introducidos en una función cuando se llama. Cuando se define una función, se define típicamente junto con uno o más parámetros. Los valores reales que son introducidos (o <dfn>"pasados"</dfn>) a una función cuando se llama son conocidos como <dfn>argumentos</dfn>.
|
||||
|
||||
Here is a function with two parameters, `param1` and `param2`:
|
||||
Esta es una función con dos parámetros, `param1` y `param2`:
|
||||
|
||||
```js
|
||||
function testFun(param1, param2) {
|
||||
@ -19,21 +19,21 @@ function testFun(param1, param2) {
|
||||
}
|
||||
```
|
||||
|
||||
Then we can call `testFun`: `testFun("Hello", "World");` We have passed two arguments, `"Hello"` and `"World"`. Inside the function, `param1` will equal "Hello" and `param2` will equal "World". Note that you could call `testFun` again with different arguments and the parameters would take on the value of the new arguments.
|
||||
Entonces podemos llamar a `testFun` así: `testFun("Hello", "World");`. Hemos pasado dos argumentos de cadena, `Hello` y `World`. Dentro de la función, `param1` será igual a la cadena `Hello` y `param2` será igual a la cadena `World`. Ten en cuenta que podrías llamar a `testFun` otra vez con diferentes argumentos y los parámetros tomarían el valor de los nuevos argumentos.
|
||||
|
||||
# --instructions--
|
||||
|
||||
<ol><li>Create a function called <code>functionWithArgs</code> that accepts two arguments and outputs their sum to the dev console.</li><li>Call the function with two numbers as arguments.</li></ol>
|
||||
<ol><li>Crea una función llamada <code>functionWithArgs</code> que acepte dos argumentos y muestre la suma de ellos en la consola de desarrollador.</li><li>Llama a la función con dos números como argumentos.</li></ol>
|
||||
|
||||
# --hints--
|
||||
|
||||
`functionWithArgs` should be a function.
|
||||
`functionWithArgs` debe ser una función.
|
||||
|
||||
```js
|
||||
assert(typeof functionWithArgs === 'function');
|
||||
```
|
||||
|
||||
`functionWithArgs(1,2)` should output `3`.
|
||||
`functionWithArgs(1,2)` debe mostrar `3`.
|
||||
|
||||
```js
|
||||
if (typeof functionWithArgs === 'function') {
|
||||
@ -44,7 +44,7 @@ if (typeof functionWithArgs === 'function') {
|
||||
assert(logOutput == 3);
|
||||
```
|
||||
|
||||
`functionWithArgs(7,9)` should output `16`.
|
||||
`functionWithArgs(7,9)` debe mostrar `16`.
|
||||
|
||||
```js
|
||||
if (typeof functionWithArgs === 'function') {
|
||||
@ -55,7 +55,7 @@ if (typeof functionWithArgs === 'function') {
|
||||
assert(logOutput == 16);
|
||||
```
|
||||
|
||||
You should call `functionWithArgs` with two numbers after you define it.
|
||||
Debes llamar `functionWithArgs` con dos números después de definirla.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -105,7 +105,9 @@ if (typeof functionWithArgs !== "function") {
|
||||
```
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 599a789b454f2bbd91a3ff4d
|
||||
title: Practice comparing different values
|
||||
title: Practica comparando diferentes valores
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/cm8PqCa'
|
||||
forumTopicId: 301174
|
||||
@ -9,44 +9,42 @@ dashedName: practice-comparing-different-values
|
||||
|
||||
# --description--
|
||||
|
||||
In the last two challenges, we learned about the equality operator (`==`) and the strict equality operator (`===`). Let's do a quick review and practice using these operators some more.
|
||||
En los dos últimos desafíos, aprendimos sobre el operador de igualdad (`==`) y el operador de estricta igualdad (`===`). Vamos a hacer una rápida revisión y práctica utilizando estos operadores un poco más.
|
||||
|
||||
If the values being compared are not of the same type, the equality operator will perform a type conversion, and then evaluate the values. However, the strict equality operator will compare both the data type and value as-is, without converting one type to the other.
|
||||
Si los valores que se comparan no son del mismo tipo, el operador de igualdad realizará una conversión de tipo y luego evaluará los valores. Sin embargo, el operador de estricta igualdad comparará tanto el tipo de datos como el valor tal como es, sin convertir un tipo a otro.
|
||||
|
||||
**Examples**
|
||||
**Ejemplos**
|
||||
|
||||
`3 == '3'` devuelve `true` porque JavaScript realiza la conversión de tipo de cadena a número. `3 === '3'` devuelve false porque los tipos son diferentes y la conversión de tipo no se realiza.
|
||||
|
||||
**Nota:** En JavaScript, puedes determinar el tipo de una variable o un valor con el operador `typeof`, de la siguiente manera:
|
||||
|
||||
```js
|
||||
3 == '3' // returns true because JavaScript performs type conversion from string to number
|
||||
3 === '3' // returns false because the types are different and type conversion is not performed
|
||||
typeof 3
|
||||
typeof '3'
|
||||
```
|
||||
|
||||
**Note**
|
||||
In JavaScript, you can determine the type of a variable or a value with the `typeof` operator, as follows:
|
||||
|
||||
```js
|
||||
typeof 3 // returns 'number'
|
||||
typeof '3' // returns 'string'
|
||||
```
|
||||
`typeof 3` devuelve la cadena `number` y `typeof '3'` devuelve la cadena `string`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
The `compareEquality` function in the editor compares two values using the equality operator. Modify the function so that it returns "Equal" only when the values are strictly equal.
|
||||
La función `compareEquality` en el editor compara dos valores usando el operador de igualdad. Modifica la función para que devuelva la cadena `Equal` sólo cuando los valores son estrictamente iguales.
|
||||
|
||||
# --hints--
|
||||
|
||||
`compareEquality(10, "10")` should return "Not Equal"
|
||||
`compareEquality(10, "10")` debe devolver la cadena `Not Equal`
|
||||
|
||||
```js
|
||||
assert(compareEquality(10, '10') === 'Not Equal');
|
||||
```
|
||||
|
||||
`compareEquality("20", 20)` should return "Not Equal"
|
||||
`compareEquality("20", 20)` debe devolver la cadena `Not Equal`
|
||||
|
||||
```js
|
||||
assert(compareEquality('20', 20) === 'Not Equal');
|
||||
```
|
||||
|
||||
You should use the `===` operator
|
||||
Debes usar el operador `===`
|
||||
|
||||
```js
|
||||
assert(code.match(/===/g));
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5688e62ea601b2482ff8422b
|
||||
title: Profile Lookup
|
||||
title: Búsqueda de perfiles
|
||||
challengeType: 1
|
||||
videoUrl: 'https://scrimba.com/c/cDqW2Cg'
|
||||
forumTopicId: 18259
|
||||
@ -9,27 +9,27 @@ dashedName: profile-lookup
|
||||
|
||||
# --description--
|
||||
|
||||
We have an array of objects representing different people in our contacts lists.
|
||||
Tenemos un arreglo de objetos que representan a diferentes personas en nuestras listas de contactos.
|
||||
|
||||
A `lookUpProfile` function that takes `name` and a property (`prop`) as arguments has been pre-written for you.
|
||||
Una función `lookUpProfile` que recibe nombre (`name`) y una propiedad (`prop`) como argumentos preescritos para ti.
|
||||
|
||||
The function should check if `name` is an actual contact's `firstName` and the given property (`prop`) is a property of that contact.
|
||||
La función debe verificar si el nombre (`name`) es el nombre de pila del contacto (`firstName`) y la propiedad (`prop`) dada es una propiedad de ese contacto.
|
||||
|
||||
If both are true, then return the "value" of that property.
|
||||
Si ambos son verdaderos, entonces devolver el "valor" de esa propiedad.
|
||||
|
||||
If `name` does not correspond to any contacts then return `"No such contact"`.
|
||||
Si `name` no corresponde a ningún contacto, entonces devuelve la cadena `No such contact`.
|
||||
|
||||
If `prop` does not correspond to any valid properties of a contact found to match `name` then return `"No such property"`.
|
||||
Si `prop` no corresponde a ninguna propiedad válida de un contacto encontrado que coincida con `name` entonces devuelve la cadena `No such property`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`lookUpProfile("Kristian", "lastName")` should return `"Vos"`
|
||||
`lookUpProfile("Kristian", "lastName")` debe devolver la cadena `Vos`
|
||||
|
||||
```js
|
||||
assert(lookUpProfile('Kristian', 'lastName') === 'Vos');
|
||||
```
|
||||
|
||||
`lookUpProfile("Sherlock", "likes")` should return `["Intriguing Cases", "Violin"]`
|
||||
`lookUpProfile("Sherlock", "likes")` debe devolver `["Intriguing Cases", "Violin"]`
|
||||
|
||||
```js
|
||||
assert.deepEqual(lookUpProfile('Sherlock', 'likes'), [
|
||||
@ -38,25 +38,25 @@ assert.deepEqual(lookUpProfile('Sherlock', 'likes'), [
|
||||
]);
|
||||
```
|
||||
|
||||
`lookUpProfile("Harry", "likes")` should return an array
|
||||
`lookUpProfile("Harry", "likes")` debe devolver un arreglo
|
||||
|
||||
```js
|
||||
assert(typeof lookUpProfile('Harry', 'likes') === 'object');
|
||||
```
|
||||
|
||||
`lookUpProfile("Bob", "number")` should return "No such contact"
|
||||
`lookUpProfile("Bob", "number")` debe devolver la cadena `No such contact`
|
||||
|
||||
```js
|
||||
assert(lookUpProfile('Bob', 'number') === 'No such contact');
|
||||
```
|
||||
|
||||
`lookUpProfile("Bob", "potato")` should return "No such contact"
|
||||
`lookUpProfile("Bob", "potato")` debe devolver la cadena `No such contact`
|
||||
|
||||
```js
|
||||
assert(lookUpProfile('Bob', 'potato') === 'No such contact');
|
||||
```
|
||||
|
||||
`lookUpProfile("Akira", "address")` should return "No such property"
|
||||
`lookUpProfile("Akira", "address")` debe devolver la cadena `No such property`
|
||||
|
||||
```js
|
||||
assert(lookUpProfile('Akira', 'address') === 'No such property');
|
||||
|
Reference in New Issue
Block a user