From a4e4ffce99f1d583c241960a184c29b5338378a0 Mon Sep 17 00:00:00 2001 From: camperbot Date: Thu, 18 Mar 2021 11:16:46 -0600 Subject: [PATCH] chore(i8n,curriculum): processed translations (#41521) Co-authored-by: Crowdin Bot --- .../basic-css/import-a-google-font.md | 7 ++-- .../add-placeholder-text-to-a-text-field.md | 16 +++++---- ...ignment-to-assign-variables-from-arrays.md | 26 ++++++++------ ...to-assign-variables-from-nested-objects.md | 20 +++++------ ...gnment-to-assign-variables-from-objects.md | 21 ++++++----- ...signment-to-extract-values-from-objects.md | 31 ++++++++-------- ...ass-an-object-as-a-functions-parameters.md | 24 ++++++------- ...st-parameter-to-reassign-array-elements.md | 24 +++++++------ .../es6/use-export-to-share-a-code-block.md | 14 ++++---- ...rest-parameter-with-function-parameters.md | 26 +++++++------- ...ad-operator-to-evaluate-arrays-in-place.md | 28 ++++++++------- ...ramming-to-convert-strings-to-url-slugs.md | 28 +++++++-------- ...ray-into-a-string-using-the-join-method.md | 22 ++++++------ ...lement-the-filter-method-on-a-prototype.md | 10 +++--- ...ion-to-currying-and-partial-application.md | 36 +++++++++---------- ...actor-global-variables-out-of-functions.md | 22 ++++++------ 16 files changed, 186 insertions(+), 169 deletions(-) diff --git a/curriculum/challenges/espanol/01-responsive-web-design/basic-css/import-a-google-font.md b/curriculum/challenges/espanol/01-responsive-web-design/basic-css/import-a-google-font.md index b6c52eb371..945fc1b287 100644 --- a/curriculum/challenges/espanol/01-responsive-web-design/basic-css/import-a-google-font.md +++ b/curriculum/challenges/espanol/01-responsive-web-design/basic-css/import-a-google-font.md @@ -19,8 +19,11 @@ Para importar una fuente de Google, puedes copiar la URL de la fuente desde la l `` -Ahora puedes usar la fuente `Lobster` en tu código CSS usando `Lobster` como FAMILY_NAME, siguiendo la sintaxis del siguiente ejemplo (aquí, FAMILY_NAME significa "nombre de la familia de fuentes", y GENERIC_NAME significa "nombre genérico"): -`font-family: FAMILY_NAME, GENERIC_NAME;`. +Ahora puedes usar la fuente `Lobster` en tu CSS usando `Lobster` como FAMILY_NAME como en el siguiente ejemplo: + +```css +font-family: FAMILY_NAME, GENERIC_NAME; +``` GENERIC_NAME es opcional, y es el modo de especificar una fuente de reserva o "fallback font" en caso de que la otra fuente especificada no esté disponible. Veremos esto en el siguiente desafío. diff --git a/curriculum/challenges/espanol/01-responsive-web-design/basic-html-and-html5/add-placeholder-text-to-a-text-field.md b/curriculum/challenges/espanol/01-responsive-web-design/basic-html-and-html5/add-placeholder-text-to-a-text-field.md index a5b4949b1a..0dfdbaabf1 100644 --- a/curriculum/challenges/espanol/01-responsive-web-design/basic-html-and-html5/add-placeholder-text-to-a-text-field.md +++ b/curriculum/challenges/espanol/01-responsive-web-design/basic-html-and-html5/add-placeholder-text-to-a-text-field.md @@ -13,23 +13,25 @@ El texto provisional es lo que se muestra en tu elemento de entrada `input` ante Puedes crear texto provisional así: -`` +```html + +``` -**Note:** Recuerda que los elementos `input` se cierran automáticamente. +**Nota:** Recuerda que los elementos `input` se cierran solos. # --instructions-- -Establece el valor provisional `placeholder` de tu entrada de texto `input` como "cat photo URL". +Establece el valor de `placeholder` de tu `input` de texto en "cat photo URL". # --hints-- -Debes agregar un atributo `placeholder` al elemento de entrada de texto `input` existente. +Debes agregar un atributo `placeholder` al elemento existente `input` de texto. ```js assert($('input[placeholder]').length > 0); ``` -Debes establecer el valor de tu atributo provisional `placeholder` como `cat photo URL`. +Debes establecer el valor de tu atributo `placeholder` en `cat photo URL`. ```js assert( @@ -41,13 +43,13 @@ assert( ); ``` -El elemento `input` final no debe tener una etiqueta de cierre. +El elemento `input` terminado no debe tener una etiqueta de cierre. ```js assert(!code.match(/.*<\/input>/gi)); ``` -El elemento `input` final debe tener una sintaxis válida. +El elemento `input` terminado debe tener una sintaxis válida. ```js assert($('input[type=text]').length > 0); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md index 1c13043c13..5d55a85a74 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md @@ -1,6 +1,6 @@ --- id: 587d7b89367417b2b2512b4b -title: Use Destructuring Assignment to Assign Variables from Arrays +title: Usa sintaxis de desestructuración para asignar variables desde arreglos challengeType: 1 forumTopicId: 301213 dashedName: use-destructuring-assignment-to-assign-variables-from-arrays @@ -8,43 +8,47 @@ dashedName: use-destructuring-assignment-to-assign-variables-from-arrays # --description-- -ES6 makes destructuring arrays as easy as destructuring objects. +ES6 hace que desestructurar arreglos sea tan fácil como desestructurar objetos. -One key difference between the spread operator and array destructuring is that the spread operator unpacks all contents of an array into a comma-separated list. Consequently, you cannot pick or choose which elements you want to assign to variables. +Una diferencia clave entre el operador de propagación y la desestructuración de arreglos es que el operador de propagación desempaca todos los contenidos de un arreglo en una lista separada por comas. En consecuencia, no puedes elegir qué elementos deseas asignar como variables. -Destructuring an array lets us do exactly that: +Desestructurar un arreglo nos permite hacer exactamente eso: ```js const [a, b] = [1, 2, 3, 4, 5, 6]; -console.log(a, b); // 1, 2 +console.log(a, b); ``` -The variable `a` is assigned the first value of the array, and `b` is assigned the second value of the array. We can also access the value at any index in an array with destructuring by using commas to reach the desired index: +La consola mostrará los valores de `a` y `b` como `1, 2`. + +A la variable `a` se le asigna el primer valor del arreglo, y a `b` se le asigna el segundo valor del arreglo. También podemos acceder al valor en cualquier índice de un arreglo con la desestructuración usando comas para alcanzar el índice deseado: ```js const [a, b,,, c] = [1, 2, 3, 4, 5, 6]; -console.log(a, b, c); // 1, 2, 5 +console.log(a, b, c); ``` +La consola mostrará los valores de `a`, `b`, y `c` como `1, 2, 5`. + # --instructions-- -Use destructuring assignment to swap the values of `a` and `b` so that `a` receives the value stored in `b`, and `b` receives the value stored in `a`. +Utiliza la sintaxis de desestructuración para intercambiar los valores de `a` y `b` para que `a` reciba el valor almacenado en `b`, y `b` reciba el valor almacenado en `a`. # --hints-- -Value of `a` should be 6, after swapping. +El valor de `a` debe ser `6`, después del intercambio. ```js assert(a === 6); ``` -Value of `b` should be 8, after swapping. +El valor de `b` debe ser `8`, después del intercambio. ```js assert(b === 8); ``` -You should use array destructuring to swap a and b. +Debes usar la desestructuración de arreglos para intercambiar `a` y `b`. ```js assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(code)); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md index 23f5ff9888..de1258d447 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md @@ -1,6 +1,6 @@ --- id: 587d7b89367417b2b2512b4a -title: Use Destructuring Assignment to Assign Variables from Nested Objects +title: Usa sintaxis de desestructuración para asignar variables desde objetos anidados challengeType: 1 forumTopicId: 301214 dashedName: use-destructuring-assignment-to-assign-variables-from-nested-objects @@ -8,9 +8,9 @@ dashedName: use-destructuring-assignment-to-assign-variables-from-nested-objects # --description-- -You can use the same principles from the previous two lessons to destructure values from nested objects. +Puedes usar los mismos principios de las dos lecciones anteriores para desestructurar los valores desde objetos anidados. -Using an object similar to previous examples: +Usando un objeto similar a los ejemplos anteriores: ```js const user = { @@ -21,13 +21,13 @@ const user = { }; ``` -Here's how to extract the values of object properties and assign them to variables with the same name: +Así es como se extraen los valores de propiedades de objetos y se los asigna a variables con el mismo nombre: ```js const { johnDoe: { age, email }} = user; ``` -And here's how you can assign an object properties' values to variables with different names: +Y así es como se puede asignar los valores de las propiedades de un objeto a variables con diferentes nombres: ```js const { johnDoe: { age: userAge, email: userEmail }} = user; @@ -35,11 +35,11 @@ const { johnDoe: { age: userAge, email: userEmail }} = user; # --instructions-- -Replace the two assignments with an equivalent destructuring assignment. It should still assign the variables `lowToday` and `highToday` the values of `today.low` and `today.high` from the `LOCAL_FORECAST` object. +Reemplaza las dos asignaciones con una sintaxis de desestructuración equivalente. Todavía deben seguir asignando las variables `lowToday` y `highToday` con los valores de `today.low` y `today.high` del objeto `LOCAL_FORECAST`. # --hints-- -You should remove the ES5 assignment syntax. +Debes eliminar la sintaxis de asignación ES5. ```js assert( @@ -48,7 +48,7 @@ assert( ); ``` -You should use destructuring to create the `lowToday` variable. +Debes usar desestructuración para crear la variable `lowToday`. ```js assert( @@ -58,7 +58,7 @@ assert( ); ``` -You should use destructuring to create the `highToday` variable. +Debes usar desestructuración para crear la variable `highToday`. ```js assert( @@ -68,7 +68,7 @@ assert( ); ``` -`lowToday` should be equal to `64` and `highToday` should be equal to `77`. +`lowToday` debe ser igual a `64` y `highToday` debe ser igual a `77`. ```js assert(lowToday === 64 && highToday === 77); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md index c0689cacb3..5dead4cb4b 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md @@ -1,6 +1,6 @@ --- id: 587d7b89367417b2b2512b49 -title: Use Destructuring Assignment to Assign Variables from Objects +title: Usa sintaxis de desestructuración para asignar variables desde objetos challengeType: 1 forumTopicId: 301215 dashedName: use-destructuring-assignment-to-assign-variables-from-objects @@ -8,30 +8,29 @@ dashedName: use-destructuring-assignment-to-assign-variables-from-objects # --description-- -Destructuring allows you to assign a new variable name when extracting values. You can do this by putting the new name after a colon when assigning the value. +La desestructuración te permite asignar un nuevo nombre de variable al extraer valores. Puedes hacer esto al poner el nuevo nombre después de dos puntos al asignar el valor. -Using the same object from the last example: +Usando el mismo objeto del ejemplo anterior: ```js const user = { name: 'John Doe', age: 34 }; ``` -Here's how you can give new variable names in the assignment: +Así es como puedes dar nuevos nombres de variables en la asignación: ```js const { name: userName, age: userAge } = user; -// userName = 'John Doe', userAge = 34 ``` -You may read it as "get the value of `user.name` and assign it to a new variable named `userName`" and so on. +Puedes leerlo como "obtén el valor de `user.name` y asígnalo a una nueva variable llamada `userName`" y así sucesivamente. El valor de `userName` sería la cadena `John Doe`, y el valor de `userAge` sería el número `34`. # --instructions-- -Replace the two assignments with an equivalent destructuring assignment. It should still assign the variables `highToday` and `highTomorrow` the values of `today` and `tomorrow` from the `HIGH_TEMPERATURES` object. +Reemplaza las dos asignaciones con una sintaxis de desestructuración equivalente. Todavía deben seguir asignando las variables `highToday` y `highTomorrow` con los valores de `today` y `tomorrow` del objeto `HIGH_TEMPERATURES`. # --hints-- -You should remove the ES5 assignment syntax. +Debes eliminar la sintaxis de asignación ES5. ```js assert( @@ -40,7 +39,7 @@ assert( ); ``` -You should use destructuring to create the `highToday` variable. +Debes usar desestructuración para crear la variable `highToday`. ```js assert( @@ -50,7 +49,7 @@ assert( ); ``` -You should use destructuring to create the `highTomorrow` variable. +Debes usar desestructuración para crear la variable `highTomorrow`. ```js assert( @@ -60,7 +59,7 @@ assert( ); ``` -`highToday` should be equal to `77` and `highTomorrow` should be equal to `80`. +`highToday` debe ser igual a `77` y `highTomorrow` debe ser igual a `80`. ```js assert(highToday === 77 && highTomorrow === 80); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md index ec873a1fa2..f44d4395cb 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md @@ -1,6 +1,6 @@ --- id: 5cfa550e84205a357704ccb6 -title: Use Destructuring Assignment to Extract Values from Objects +title: Usa sintaxis de desestructuración para extraer valores de objetos challengeType: 1 forumTopicId: 301216 dashedName: use-destructuring-assignment-to-extract-values-from-objects @@ -8,35 +8,38 @@ dashedName: use-destructuring-assignment-to-extract-values-from-objects # --description-- -Destructuring assignment is special syntax introduced in ES6, for neatly assigning values taken directly from an object. +La sintaxis de desestructuración es una sintaxis especial introducida en ES6, para asignar los valores directamente desde un objeto. -Consider the following ES5 code: +Considera el siguiente código ES5: ```js const user = { name: 'John Doe', age: 34 }; -const name = user.name; // name = 'John Doe' -const age = user.age; // age = 34 +const name = user.name; +const age = user.age; ``` -Here's an equivalent assignment statement using the ES6 destructuring syntax: +`name` tendría una cadena con valor `John Doe`, y `age` tendría el número `34`. + +Aquí hay una sentencia de asignación equivalente usando la sintaxis de desestructuración de ES6: ```js const { name, age } = user; -// name = 'John Doe', age = 34 ``` -Here, the `name` and `age` variables will be created and assigned the values of their respective values from the `user` object. You can see how much cleaner this is. +De nuevo, `name` tendrá una cadena con valor `John Doe`, y `age` tendrá el número `34`. -You can extract as many or few values from the object as you want. +Aquí, las variables `name` y `age` serán creadas y se asignarán los valores respectivos a partir del objeto `user`. Puedes observar que esto es mucho más limpio. + +Puedes extraer tantos o pocos valores del objeto como desees. # --instructions-- -Replace the two assignments with an equivalent destructuring assignment. It should still assign the variables `today` and `tomorrow` the values of `today` and `tomorrow` from the `HIGH_TEMPERATURES` object. +Reemplaza las dos asignaciones con una sintaxis de desestructuración equivalente. Todavía deben seguir asignando las variables `today` y `tomorrow` con los valores de `today` y `tomorrow` del objeto `HIGH_TEMPERATURES`. # --hints-- -You should remove the ES5 assignment syntax. +Debes eliminar la sintaxis de asignación ES5. ```js assert( @@ -46,7 +49,7 @@ assert( ); ``` -You should use destructuring to create the `today` variable. +Debes usar desestructuración para crear la variable `today`. ```js assert( @@ -58,7 +61,7 @@ assert( ); ``` -You should use destructuring to create the `tomorrow` variable. +Debes usar desestructuración para crear la variable `tomorrow`. ```js assert( @@ -70,7 +73,7 @@ assert( ); ``` -`today` should be equal to `77` and `tomorrow` should be equal to `80`. +`today` debe ser igual a `77` y `tomorrow` debe ser igual a `80`. ```js assert(today === 77 && tomorrow === 80); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md index b142b79a75..b1d2e94ecc 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md @@ -1,6 +1,6 @@ --- id: 587d7b8a367417b2b2512b4d -title: Use Destructuring Assignment to Pass an Object as a Function's Parameters +title: Utiliza sintaxis de desestructuración para pasar un objeto como parámetro de función challengeType: 1 forumTopicId: 301217 dashedName: use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters @@ -8,52 +8,52 @@ dashedName: use-destructuring-assignment-to-pass-an-object-as-a-functions-parame # --description-- -In some cases, you can destructure the object in a function argument itself. +En algunos casos, se puede desestructurar el objeto en un propio argumento de función. -Consider the code below: +Considera el siguiente código: ```js const profileUpdate = (profileData) => { const { name, age, nationality, location } = profileData; - // do something with these variables + } ``` -This effectively destructures the object sent into the function. This can also be done in-place: +Esto desestructura efectivamente el objeto enviado a la función. Esto también se puede hacer en el lugar: ```js const profileUpdate = ({ name, age, nationality, location }) => { - /* do something with these fields */ + } ``` -When `profileData` is passed to the above function, the values are destructured from the function parameter for use within the function. +Cuando `profileData` es pasado a la función anterior, los valores son desestructurados desde el parámetro de función para su uso dentro de la función. # --instructions-- -Use destructuring assignment within the argument to the function `half` to send only `max` and `min` inside the function. +Utiliza la sintaxis de desestructuración dentro del argumento de la función `half` para enviar solo `max` y `min` dentro de la función. # --hints-- -`stats` should be an `object`. +`stats` debe ser un objeto (`object`). ```js assert(typeof stats === 'object'); ``` -`half(stats)` should be `28.015` +`half(stats)` debe ser `28.015` ```js assert(half(stats) === 28.015); ``` -Destructuring should be used. +Se debe utilizar desestructuración. ```js assert(__helpers.removeWhiteSpace(code).match(/half=\({\w+,\w+}\)/)); ``` -Destructured parameter should be used. +Se debe usar un parámetro desestructurado. ```js assert(!code.match(/stats\.max|stats\.min/)); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md index 47b00256aa..32d3af6f7d 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md @@ -1,7 +1,7 @@ --- id: 587d7b8a367417b2b2512b4c title: >- - Use Destructuring Assignment with the Rest Parameter to Reassign Array Elements + Utiliza la sintaxis de desestructuración con el parámetro rest para reasignar elementos de un arreglo challengeType: 1 forumTopicId: 301218 dashedName: >- @@ -10,43 +10,45 @@ dashedName: >- # --description-- -In some situations involving array destructuring, we might want to collect the rest of the elements into a separate array. +En algunas situaciones que implican la desestructuración de arreglos, tal vez queramos recolectar el resto de elementos en un arreglo separado. -The result is similar to `Array.prototype.slice()`, as shown below: +El resultado es similar a `Array.prototype.slice()`, como se muestra a continuación: ```js const [a, b, ...arr] = [1, 2, 3, 4, 5, 7]; -console.log(a, b); // 1, 2 -console.log(arr); // [3, 4, 5, 7] +console.log(a, b); +console.log(arr); ``` -Variables `a` and `b` take the first and second values from the array. After that, because of the rest parameter's presence, `arr` gets the rest of the values in the form of an array. The rest element only works correctly as the last variable in the list. As in, you cannot use the rest parameter to catch a subarray that leaves out the last element of the original array. +La consola mostrará los valores `1, 2` y `[3, 4, 5, 7]`. + +Las variables `a` y `b` toman el primer y segundo valor del arreglo. Después de eso, debido a la presencia del parámetro rest, `arr` obtiene el resto de los valores en forma de un arreglo. El elemento rest sólo funciona correctamente como la última variable en la lista. Por ejemplo, no puedes usar el parámetro rest para capturar un sub-arreglo que deje fuera el último elemento del arreglo original. # --instructions-- -Use destructuring assignment with the rest parameter to perform an effective `Array.prototype.slice()` so that `arr` is a sub-array of the original array `source` with the first two elements omitted. +Utiliza la sintaxis de desestructuración con el parámetro rest para realizar un `Array.prototype.slice()` eficaz, de tal manera que `arr` sea un sub-arreglo del arreglo original `source` con los dos primeros elementos omitidos. # --hints-- -`arr` should be `[3,4,5,6,7,8,9,10]` +`arr` debe ser `[3,4,5,6,7,8,9,10]` ```js assert(arr.every((v, i) => v === i + 3) && arr.length === 8); ``` -`source` should be `[1,2,3,4,5,6,7,8,9,10]` +`source` debe ser `[1,2,3,4,5,6,7,8,9,10]` ```js assert(source.every((v, i) => v === i + 1) && source.length === 10); ``` -`Array.slice()` should not be used. +`Array.slice()` no debe ser usado. ```js (getUserInput) => assert(!getUserInput('index').match(/slice/g)); ``` -Destructuring on `list` should be used. +Se debe utilizar desestructuración en `list`. ```js assert( diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md index cffcbbe642..1b1a135605 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md @@ -1,6 +1,6 @@ --- id: 587d7b8c367417b2b2512b56 -title: Use export to Share a Code Block +title: Utiliza la exportación para compartir un bloque de código challengeType: 1 forumTopicId: 301219 dashedName: use-export-to-share-a-code-block @@ -8,7 +8,7 @@ dashedName: use-export-to-share-a-code-block # --description-- -Imagine a file called `math_functions.js` that contains several functions related to mathematical operations. One of them is stored in a variable, `add`, that takes in two numbers and returns their sum. You want to use this function in several different JavaScript files. In order to share it with these other files, you first need to `export` it. +Imagina un archivo llamado `math_functions.js` que contiene varias funciones relacionadas con operaciones matemáticas. Uno de ellos se almacena en una variable, `add`, que toma dos números y devuelve su suma. Quieres utilizar esta función en varios archivos JavaScript diferentes. Para compartirlo con estos otros archivos, primero debes usar `export` (exportarlo). ```js export const add = (x, y) => { @@ -16,7 +16,7 @@ export const add = (x, y) => { } ``` -The above is a common way to export a single function, but you can achieve the same thing like this: +Lo anterior es una forma común de exportar una sola función, pero puedes lograr lo mismo como esto: ```js const add = (x, y) => { @@ -26,7 +26,7 @@ const add = (x, y) => { export { add }; ``` -When you export a variable or function, you can import it in another file and use it without having to rewrite the code. You can export multiple things by repeating the first example for each thing you want to export, or by placing them all in the export statement of the second example, like this: +Cuando exportas una variable o función, puedes importarla en otro archivo y usarla sin tener que volver a escribir el código. Puedes exportar diferentes cosas al repartir el primer ejemplo para cada una de ellas si quieres exportar o al colocarlas en la declaración de exportación del segundo ejemplo. Por ejemplo: ```js export { add, subtract }; @@ -34,11 +34,11 @@ export { add, subtract }; # --instructions-- -There are two string-related functions in the editor. Export both of them using the method of your choice. +Hay dos funciones relacionadas con cadenas en el editor. Exporta ambos utilizando el método que elijas. # --hints-- -You should properly export `uppercaseString`. +Deberías exportar correctamente `uppercaseString`. ```js assert( @@ -48,7 +48,7 @@ assert( ); ``` -You should properly export `lowercaseString`. +Deberías exportar correctamente `lowercaseString`. ```js assert( diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md index 888e68da6b..a0067745e2 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md @@ -1,6 +1,6 @@ --- id: 587d7b88367417b2b2512b47 -title: Use the Rest Parameter with Function Parameters +title: Utiliza el parámetro rest con parámetros de función challengeType: 1 forumTopicId: 301221 dashedName: use-the-rest-parameter-with-function-parameters @@ -8,51 +8,53 @@ dashedName: use-the-rest-parameter-with-function-parameters # --description-- -In order to help us create more flexible functions, ES6 introduces the rest parameter for function parameters. With the rest parameter, you can create functions that take a variable number of arguments. These arguments are stored in an array that can be accessed later from inside the function. +Para ayudarnos a crear funciones más flexibles, ES6 introduce el parámetro rest para los parámetros de función. Con el parámetro rest, puedes crear funciones que tomen un número variable de argumentos. Estos argumentos se almacenan en un arreglo al que se puede acceder más tarde desde dentro de la función. -Check out this code: +Echa un vistazo a este código: ```js function howMany(...args) { return "You have passed " + args.length + " arguments."; } -console.log(howMany(0, 1, 2)); // You have passed 3 arguments. -console.log(howMany("string", null, [1, 2, 3], { })); // You have passed 4 arguments. +console.log(howMany(0, 1, 2)); +console.log(howMany("string", null, [1, 2, 3], { })); ``` -The rest parameter eliminates the need to check the `args` array and allows us to apply `map()`, `filter()` and `reduce()` on the parameters array. +La consola mostrará las cadenas `You have passed 3 arguments.` y `You have passed 4 arguments.`. + +El parámetro rest elimina la necesidad de comprobar el arreglo `args` y nos permite aplicar `map()`, `filter()` y `reduce()` en el arreglo de parámetros. # --instructions-- -Modify the function `sum` using the rest parameter in such a way that the function `sum` is able to take any number of arguments and return their sum. +Modifica la función `sum` usando el parámetro rest de tal manera que la función `sum` sea capaz de recibir cualquier número de argumentos y devolver su suma. # --hints-- -The result of `sum(0,1,2)` should be 3 +El resultado de `sum(0,1,2)` debe ser 3 ```js assert(sum(0, 1, 2) === 3); ``` -The result of `sum(1,2,3,4)` should be 10 +El resultado de `sum(1,2,3,4)` debe ser 10 ```js assert(sum(1, 2, 3, 4) === 10); ``` -The result of `sum(5)` should be 5 +El resultado de `sum(5)` debe ser 5 ```js assert(sum(5) === 5); ``` -The result of `sum()` should be 0 +El resultado de `sum()` debe ser 0 ```js assert(sum() === 0); ``` -`sum` should be an arrow function which uses the rest parameter syntax (`...`) on the `args` parameter. +`sum` debe ser una función flecha que utilice la sintaxis de parámetro rest (`...`) en el parámetro `args`. ```js assert(__helpers.removeWhiteSpace(code).match(/sum=\(\.\.\.args\)=>/)); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md index 9fa3b6b1b5..902e3ced77 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md @@ -1,6 +1,6 @@ --- id: 587d7b89367417b2b2512b48 -title: Use the Spread Operator to Evaluate Arrays In-Place +title: Utiliza el operador de propagación para evaluar los arreglos en el lugar challengeType: 1 forumTopicId: 301222 dashedName: use-the-spread-operator-to-evaluate-arrays-in-place @@ -8,47 +8,51 @@ dashedName: use-the-spread-operator-to-evaluate-arrays-in-place # --description-- -ES6 introduces the spread operator, which allows us to expand arrays and other expressions in places where multiple parameters or elements are expected. +ES6 introduce el operador de propagación, que nos permite expandir arreglos y otras expresiones en lugares donde se esperan múltiples parámetros o elementos. -The ES5 code below uses `apply()` to compute the maximum value in an array: +El siguiente código ES5 usa `apply()` para calcular el valor máximo en un arreglo: ```js var arr = [6, 89, 3, 45]; -var maximus = Math.max.apply(null, arr); // returns 89 +var maximus = Math.max.apply(null, arr); ``` -We had to use `Math.max.apply(null, arr)` because `Math.max(arr)` returns `NaN`. `Math.max()` expects comma-separated arguments, but not an array. The spread operator makes this syntax much better to read and maintain. +`maximus` tendrá un valor de `89`. + +Tuvimos que usar `Math.max.apply(null, arr)` porque `Math.max(arr)` devuelve `NaN`. `Math.max()` espera argumentos separados por comas, pero no un arreglo. El operador de propagación hace que esta sintaxis sea más fácil de leer y mantener. ```js const arr = [6, 89, 3, 45]; -const maximus = Math.max(...arr); // returns 89 +const maximus = Math.max(...arr); ``` -`...arr` returns an unpacked array. In other words, it *spreads* the array. However, the spread operator only works in-place, like in an argument to a function or in an array literal. The following code will not work: +`maximus` tendría un valor de `89`. + +`...arr` devuelve un arreglo desempacado. En otras palabras, *propaga* el arreglo. Sin embargo, el operador de propagación sólo funciona en el lugar, como en un argumento de función o en un arreglo literal. El siguiente código no funcionará: ```js -const spreaded = ...arr; // will throw a syntax error +const spreaded = ...arr; ``` # --instructions-- -Copy all contents of `arr1` into another array `arr2` using the spread operator. +Copia todo el contenido de `arr1` en otro arreglo `arr2` usando el operador de propagación. # --hints-- -`arr2` should be correct copy of `arr1`. +`arr2` debe ser una copia correcta de `arr1`. ```js assert(arr2.every((v, i) => v === arr1[i]) && arr2.length); ``` -`...` spread operator should be used to duplicate `arr1`. +El operador de propagación `...` debe utilizarse para duplicar `arr1`. ```js assert(code.match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); ``` -`arr2` should remain unchanged when `arr1` is changed. +`arr2` debe permanecer sin cambios cuando `arr1` cambie. ```js assert((arr1, arr2) => { diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md index bec46bed96..b2d3672f33 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md @@ -1,6 +1,6 @@ --- id: 587d7dab367417b2b2512b6d -title: Apply Functional Programming to Convert Strings to URL Slugs +title: Aplicar programación funcional para convertir cadenas a slugs de URL challengeType: 1 forumTopicId: 301227 dashedName: apply-functional-programming-to-convert-strings-to-url-slugs @@ -8,45 +8,45 @@ dashedName: apply-functional-programming-to-convert-strings-to-url-slugs # --description-- -The last several challenges covered a number of useful array and string methods that follow functional programming principles. We've also learned about `reduce`, which is a powerful method used to reduce problems to simpler forms. From computing averages to sorting, any array operation can be achieved by applying it. Recall that `map` and `filter` are special cases of `reduce`. +Los últimos desafíos abarcaban una serie de métodos útiles para arreglos y cadenas, que siguen los principios de la programación funcional. También hemos aprendido acerca de `reduce`, que es un poderoso método utilizado para reducir los problemas a formas más simples. Desde el cálculo de promedios a la ordenación, cualquier operación con arreglos puede lograrse si lo aplicamos. Recuerda que `map` y `filter` son casos especiales de `reduce`. -Let's combine what we've learned to solve a practical problem. +Combinemos lo que hemos aprendido para resolver un problema práctico. -Many content management sites (CMS) have the titles of a post added to part of the URL for simple bookmarking purposes. For example, if you write a Medium post titled "Stop Using Reduce", it's likely the URL would have some form of the title string in it (".../stop-using-reduce"). You may have already noticed this on the freeCodeCamp site. +Muchos sitios de gestión de contenidos (CMS) tienen los títulos de una publicación añadidos como parte de la URL con el simple propósito de ser marcadores. Por ejemplo, si escribes una publicación titulada `Stop Using Reduce`, es probable que la url tenga parte de este titulo en ella (`.../stop-using-reduce`). Puede que ya hayas notado esto en el sitio de freeCodeCamp. # --instructions-- -Fill in the `urlSlug` function so it converts a string `title` and returns the hyphenated version for the URL. You can use any of the methods covered in this section, and don't use `replace`. Here are the requirements: +Rellena la función `urlSlug` para convertir una cadena `title` y devolver la versión con guiones para la URL. Puedes utilizar cualquiera de los métodos vistos en esta sección y no utilices `replace`. Aquí están los requisitos: -The input is a string with spaces and title-cased words +La entrada es una cadena con espacios y palabras, en mayúsculas y minúsculas -The output is a string with the spaces between words replaced by a hyphen (`-`) +El resultado es una cadena con los espacios entre palabras reemplazadas por un guion (`-`) -The output should be all lower-cased letters +El resultado debe contener todas las letras minúsculas -The output should not have any spaces +El resultado no debe tener espacios # --hints-- -Your code should not use the `replace` method for this challenge. +Tu código no debe utilizar el método `replace` para este desafío. ```js assert(!code.match(/\.?[\s\S]*?replace/g)); ``` -`urlSlug("Winter Is Coming")` should return `"winter-is-coming"`. +`urlSlug("Winter Is Coming")` debe devolver la cadena `winter-is-coming`. ```js assert(urlSlug('Winter Is Coming') === 'winter-is-coming'); ``` -`urlSlug(" Winter Is Coming")` should return `"winter-is-coming"`. +`urlSlug(" Winter Is Coming")` debe devolver la cadena `winter-is-coming`. ```js assert(urlSlug(' Winter Is Coming') === 'winter-is-coming'); ``` -`urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone")` should return `"a-mind-needs-books-like-a-sword-needs-a-whetstone"`. +`urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone")` debe devolver la cadena `a-mind-needs-books-like-a-sword-needs-a-whetstone`. ```js assert( @@ -55,7 +55,7 @@ assert( ); ``` -`urlSlug("Hold The Door")` should return `"hold-the-door"`. +`urlSlug("Hold The Door")` debe devolver la cadena `hold-the-door`. ```js assert(urlSlug('Hold The Door') === 'hold-the-door'); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md index c1b662432f..4212cdfa64 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md @@ -1,6 +1,6 @@ --- id: 587d7daa367417b2b2512b6c -title: Combine an Array into a String Using the join Method +title: Combina un arreglo en una cadena utilizando el método "join" challengeType: 1 forumTopicId: 18221 dashedName: combine-an-array-into-a-string-using-the-join-method @@ -8,47 +8,47 @@ dashedName: combine-an-array-into-a-string-using-the-join-method # --description-- -The `join` method is used to join the elements of an array together to create a string. It takes an argument for the delimiter that is used to separate the array elements in the string. +El método `join` se utiliza para unir los elementos de un arreglo creando una cadena de texto. Se necesita un argumento para especificar el delimitador a utilizar para separar los elementos del arreglo en la cadena. -Here's an example: +Aquí hay un ejemplo: ```js var arr = ["Hello", "World"]; var str = arr.join(" "); -// Sets str to "Hello World" ``` +`str` tendrá una cadena con valor `Hello World`. # --instructions-- -Use the `join` method (among others) inside the `sentensify` function to make a sentence from the words in the string `str`. The function should return a string. For example, "I-like-Star-Wars" would be converted to "I like Star Wars". For this challenge, do not use the `replace` method. +Utiliza el método `join` (entre otros) dentro de la función `sentensify` para hacer una oración a partir de las palabras en la cadena `str`. La función debe devolver una cadena. Por ejemplo, `I-like-Star-Wars` se convertiría en `I like Star Wars`. Para este desafío, no utilices el método `replace`. # --hints-- -Your code should use the `join` method. +Tu código debe usar el método `join`. ```js assert(code.match(/\.join/g)); ``` -Your code should not use the `replace` method. +Tu código no debe utilizar el método `replace`. ```js assert(!code.match(/\.?[\s\S]*?replace/g)); ``` -`sentensify("May-the-force-be-with-you")` should return a string. +`sentensify("May-the-force-be-with-you")` debe devolver una cadena. ```js assert(typeof sentensify('May-the-force-be-with-you') === 'string'); ``` -`sentensify("May-the-force-be-with-you")` should return `"May the force be with you"`. +`sentensify("May-the-force-be-with-you")` debe devolver la cadena `May the force be with you`. ```js assert(sentensify('May-the-force-be-with-you') === 'May the force be with you'); ``` -`sentensify("The.force.is.strong.with.this.one")` should return `"The force is strong with this one"`. +`sentensify("The.force.is.strong.with.this.one")` debe devolver la cadena `The force is strong with this one`. ```js assert( @@ -57,7 +57,7 @@ assert( ); ``` -`sentensify("There,has,been,an,awakening")` should return `"There has been an awakening"`. +`sentensify("There,has,been,an,awakening")` debe devolver la cadena `There has been an awakening`. ```js assert( diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md index a9469de977..ebe22f322d 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md @@ -1,6 +1,6 @@ --- id: 587d7b8f367417b2b2512b64 -title: Implement the filter Method on a Prototype +title: Implementa el método filter en un prototipo challengeType: 1 forumTopicId: 301231 dashedName: implement-the-filter-method-on-a-prototype @@ -8,21 +8,21 @@ dashedName: implement-the-filter-method-on-a-prototype # --description-- -You might learn a lot about the `filter` method if you implement your own version of it. It is recommended you use a `for` loop or `Array.prototype.forEach()`. +Puedes aprender mucho sobre el método `filter` si implementas tu propia versión. Se recomienda utilizar un bucle `for` o `Array.prototype.forEach()`. # --instructions-- -Write your own `Array.prototype.myFilter()`, which should behave exactly like `Array.prototype.filter()`. You should not use the built-in `filter` method. The `Array` instance can be accessed in the `myFilter` method using `this`. +Escribe tu propio `Array.prototype.myFilter()`, que debe comportarse exactamente como `Array.prototype.filter()`. No debes utilizar el método incorporado `filter`. Se puede acceder a la instancia `Array` en el método `myFilter` usando `this`. # --hints-- -`new_s` should equal `[23, 65, 5]`. +`new_s` debe ser igual a `[23, 65, 5]`. ```js assert(JSON.stringify(new_s) === JSON.stringify([23, 65, 5])); ``` -Your code should not use the `filter` method. +Tu código no debe utilizar el método `filter`. ```js assert(!code.match(/\.?[\s\S]*?filter/g)); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md index 1d3651620f..4b0ae1f192 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md @@ -1,6 +1,6 @@ --- id: 587d7dab367417b2b2512b70 -title: Introduction to Currying and Partial Application +title: Introducción a la currificación y a la aplicación de funciones parciales challengeType: 1 forumTopicId: 301232 dashedName: introduction-to-currying-and-partial-application @@ -8,74 +8,72 @@ dashedName: introduction-to-currying-and-partial-application # --description-- -The arity of a function is the number of arguments it requires. Currying a function means to convert a function of N arity into N functions of arity 1. +La aridad de una función es el número de argumentos que requiere. Currificar una función significa convertir una función de N aridades a N funciones de 1 aridad. -In other words, it restructures a function so it takes one argument, then returns another function that takes the next argument, and so on. +En otras palabras, reestructura una función, por lo que toma un argumento, luego devolverá otra función que toma el siguiente argumento, y así sucesivamente. -Here's an example: +A continuación un ejemplo: ```js -//Un-curried function function unCurried(x, y) { return x + y; } -//Curried function function curried(x) { return function(y) { return x + y; } } -//Alternative using ES6 + const curried = x => y => x + y -curried(1)(2) // Returns 3 +curried(1)(2) ``` -This is useful in your program if you can't supply all the arguments to a function at one time. You can save each function call into a variable, which will hold the returned function reference that takes the next argument when it's available. Here's an example using the curried function in the example above: +`curried(1)(2)` devolverá `3`. + +Esto es útil en tu programa si no puedes proporcionar todos los argumentos a una función al mismo tiempo. Puedes guardar la llamada a cada función dentro de una variable, la cual mantendrá la referencia de la función devuelta que toma el siguiente argumento cuando este disponible. Aquí hay un ejemplo utilizando la función currificada del ejemplo anterior: ```js -// Call a curried function in parts: var funcForY = curried(1); -console.log(funcForY(2)); // Prints 3 +console.log(funcForY(2)); // 3 ``` -Similarly, partial application can be described as applying a few arguments to a function at a time and returning another function that is applied to more arguments. Here's an example: +Similarmente, la aplicación de una función parcial puede describirse como aplicar algunos argumentos a la función al mismo tiempo y devolviendo una función que se aplica a más argumentos. A continuación un ejemplo: ```js -//Impartial function function impartial(x, y, z) { return x + y + z; } var partialFn = impartial.bind(this, 1, 2); -partialFn(10); // Returns 13 +partialFn(10); // 13 ``` # --instructions-- -Fill in the body of the `add` function so it uses currying to add parameters `x`, `y`, and `z`. +Completa el cuerpo de la función `add` para que use currificación para añadir parámetros `x`, `y`, y `z`. # --hints-- -`add(10)(20)(30)` should return `60`. +`add(10)(20)(30)` debe devolver `60`. ```js assert(add(10)(20)(30) === 60); ``` -`add(1)(2)(3)` should return `6`. +`add(1)(2)(3)` debe devolver `6`. ```js assert(add(1)(2)(3) === 6); ``` -`add(11)(22)(33)` should return `66`. +`add(11)(22)(33)` debe devolver `66`. ```js assert(add(11)(22)(33) === 66); ``` -Your code should include a final statement that returns `x + y + z`. +Tu código deber incluir una declaración final que devuelva `x + y + z`. ```js assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.md index 0eea537b77..65847a471c 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.md @@ -1,6 +1,6 @@ --- id: 587d7b8f367417b2b2512b60 -title: Refactor Global Variables Out of Functions +title: Refactoriza variables globales por fuera de funciones challengeType: 1 forumTopicId: 301235 dashedName: refactor-global-variables-out-of-functions @@ -8,23 +8,23 @@ dashedName: refactor-global-variables-out-of-functions # --description-- -So far, we have seen two distinct principles for functional programming: +Hasta ahora, hemos visto dos principios distintos para la programación funcional: -1) Don't alter a variable or object - create new variables and objects and return them if need be from a function. Hint: using something like `var newArr = arrVar`, where `arrVar` is an array will simply create a reference to the existing variable and not a copy. So changing a value in `newArr` would change the value in `arrVar`. +1) No alteres una variable u objeto: crea nuevas variables y objetos y devuélvelos, si es necesario, desde una función. Pista: usar algo como `var newArr = arrVar`, donde `arrVar` es un arreglo, simplemente creará una referencia a la variable existente y no una copia. Así que cambiar un valor en `newArr` cambiaría el valor en `arrVar`. -2) Declare function parameters - any computation inside a function depends only on the arguments passed to the function, and not on any global object or variable. +2) Declara parámetros de función: cualquier cálculo dentro de una función depende sólo de los argumentos pasados a la función y no en ningún objeto o variable global. -Adding one to a number is not very exciting, but we can apply these principles when working with arrays or more complex objects. +Añadir uno a un número no es muy emocionante, pero podemos aplicar estos principios cuando trabajamos con arreglos u objetos más complejos. # --instructions-- -Rewrite the code so the global array `bookList` is not changed inside either function. The `add` function should add the given `bookName` to the end of the array passed to it and return a new array (list). The `remove` function should remove the given `bookName` from the array passed to it. +Reescribe el código para que el arreglo global `bookList` no sea cambiado dentro de ninguna de las funciones. La función `add` debe agregar el `bookName` dado al final del arreglo pasado a esta y devolver un nuevo arreglo (lista). La función `remove` debe eliminar el `bookName` dado del arreglo pasado a esta. -**Note:** Both functions should return an array, and any new parameters should be added before the `bookName` parameter. +**Nota:** ambas funciones deben devolver un arreglo y cualquier nuevo parámetro debe ser añadido antes del parámetro `bookName`. # --hints-- -`bookList` should not change and still equal `["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]`. +`bookList` no debe cambiar y aún ser igual a `["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]`. ```js assert( @@ -38,7 +38,7 @@ assert( ); ``` -`newBookList` should equal `["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]`. +`newBookList` debe ser igual a `["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]`. ```js assert( @@ -53,7 +53,7 @@ assert( ); ``` -`newerBookList` should equal `["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]`. +`newerBookList` debe ser igual a `["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]`. ```js assert( @@ -66,7 +66,7 @@ assert( ); ``` -`newestBookList` should equal `["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]`. +`newestBookList` debe ser igual a `["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]`. ```js assert(