chore(i8n,curriculum): processed translations (#41521)
Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
This commit is contained in:
@ -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');
|
||||
|
@ -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(
|
||||
|
@ -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));
|
||||
|
@ -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 <dfn>arity</dfn> of a function is the number of arguments it requires. <dfn>Currying</dfn> a function means to convert a function of N arity into N functions of arity 1.
|
||||
La <dfn>aridad</dfn> de una función es el número de argumentos que requiere. <dfn>Currificar</dfn> 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, <dfn>partial application</dfn> 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, <dfn>la aplicación de una función parcial</dfn> 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));
|
||||
|
@ -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(
|
||||
|
Reference in New Issue
Block a user