diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md index d788266daf..7bab587d1a 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md @@ -9,7 +9,7 @@ dashedName: escape-sequences-in-strings # --description-- -引号不是字符串中唯一可以被 转义 的字符。 使用转义字符有两个原因: +引号不是字符串中唯一可以被转义(escaped)的字符。 使用转义字符有两个原因: 1. 首先是可以让你使用无法输入的字符,例如退格。 2. 其次是可以让你在一个字符串中表示多个引号,而不会出错。 @@ -24,9 +24,9 @@ dashedName: escape-sequences-in-strings 使用转义序列把下面三行文本赋值给一个变量 `myStr`。 -
FirstLine
\SecondLine
ThirdLine
+
FirstLine
    \SecondLine
ThirdLine
-你需要使用转义字符正确地插入特殊字符, 确保间距与上面文本一致,并且单词或转义字符之间没有空格。 +你需要使用转义字符正确地插入特殊字符。 确保间距与上面文本一致,并且单词或转义字符之间没有空格。 **注意:** `SecondLine` 是因为键入了转义字符(而不是空格),所以在那个位置。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md index f7a36cb16d..5d1e6088aa 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244b4 -title: Quoting Strings with Single Quotes +title: 用单引号引用字符串 challengeType: 1 videoUrl: 'https://scrimba.com/c/cbQmnhM' forumTopicId: 18260 @@ -9,39 +9,41 @@ dashedName: quoting-strings-with-single-quotes # --description-- -String values in JavaScript may be written with single or double quotes, as long as you start and end with the same type of quote. Unlike some other programming languages, single and double quotes work the same in JavaScript. +JavaScript 中的字符串可以使用开始和结束都是同类型的单引号或双引号表示。 与其他一些编程语言不同的是,单引号和双引号的功能在 JavaScript 中是相同的。 ```js doubleQuoteStr = "This is a string"; singleQuoteStr = 'This is also a string'; ``` -The reason why you might want to use one type of quote over the other is if you want to use both in a string. This might happen if you want to save a conversation in a string and have the conversation in quotes. Another use for it would be saving an `` tag with various attributes in quotes, all within a string. +当你需要在一个字符串中使用多个引号的时候,你可以使用单引号包裹双引号或者相反。 常见的场景比如在字符串中包含对话的句子需要用引号包裹。 另外比如在一个包含有 `` 标签的字符串中,标签的属性值需要用引号包裹。 ```js conversation = 'Finn exclaims to Jake, "Algebraic!"'; ``` -However, this becomes a problem if you need to use the outermost quotes within it. Remember, a string has the same kind of quote at the beginning and end. But if you have that same quote somewhere in the middle, the string will stop early and throw an error. +然而,如果你需要在其中使用外面的引号,这就成为一个问题。 记住,一个字符串在开头和结尾处有相同的引号。 要知道,字符串在开头和结尾都有相同的引号,如果在中间使用了相同的引号,字符串会提前中止并抛出错误。 ```js goodStr = 'Jake asks Finn, "Hey, let\'s go on an adventure?"'; -badStr = 'Finn responds, "Let's go!"'; // Throws an error +badStr = 'Finn responds, "Let's go!"'; ``` -In the goodStr above, you can use both quotes safely by using the backslash \\ as an escape character. +在这里 `badStr` 会产生一个错误。 -**Note:** The backslash \\ should not be confused with the forward slash `/`. They do not do the same thing. +在上面的 goodStr 中,通过使用反斜杠 `\` 转义字符可以安全地使用两种引号。 + +**提示:**不要混淆反斜杠 `\` 和斜杠 `/`。 它们不是一回事。 # --instructions-- -Change the provided string to a string with single quotes at the beginning and end and no escape characters. +把字符串更改为开头和结尾使用单引号的字符串,并且不包含转义字符。 -Right now, the `` tag in the string uses double quotes everywhere. You will need to change the outer quotes to single quotes so you can remove the escape characters. +这样字符串中的 `` 标签里面任何地方都可以使用双引号。 你需要将最外层引号更改为单引号,以便删除转义字符。 # --hints-- -You should remove all the `backslashes` (\\). +应该删除所有反斜杠(`\`)。 ```js assert( @@ -52,7 +54,7 @@ assert( ); ``` -You should have two single quotes `'` and four double quotes `"`. +应该要有两个单引号 `'` 和四个双引号 `"`。 ```js assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2); diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md index da8f3954c9..f5c58b4109 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md @@ -8,7 +8,7 @@ dashedName: catch-mixed-usage-of-single-and-double-quotes # --description-- -JavaScript 允许使用单引号 (`'`) 和双引号 (`"`) 声明字符串。 决定使用哪一个通常看个人偏好,但有一些例外。 +JavaScript 允许使用单引号(`'`)和双引号(`"`)声明字符串。 决定使用哪一个通常看个人偏好,但有一些例外。 如果字符串中有缩写或存在一段带引号的文本,你就会明白为什么 JavaScript 允许两种引号了。 请注意,不要提前用引号结束字符串,这会导致语法错误。 @@ -22,7 +22,7 @@ const uhOhGroucho = 'I've had a perfectly wonderful evening, but this wasn't it. 前两项是正确的,但第三项是不正确的。 -当然,只使用一种引号也是可以的。 你可以使用反斜杠(`\`)转义字符来转义字符串中的引号: +当然,只使用一种引号也是可以的。 可以使用反斜杠(`\`)来转义字符串内的引号: ```js const allSameQuotes = 'I\'ve had a perfectly wonderful evening, but this wasn\'t it.'; diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md index 0c639d63a2..0b455c4a6d 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.md @@ -8,26 +8,28 @@ dashedName: reuse-patterns-using-capture-groups # --description-- -一些你所搜寻的匹配模式会在字符串中出现多次, 手动重复该正则表达式显得不够简洁。 当字符串中出现多个重复子字符串时,有一种更好的方式来编写模式。 +一些你所搜寻的匹配模式会在字符串中出现多次。 手动重复该正则表达式显得不够简洁。 当字符串中出现多个重复子字符串时,有一种更好的方式来编写模式。 -可以使用 捕获组 搜寻重复的子字符串。 括号 `(` 和 `)` 可以用来匹配重复的子字符串。 把需要重复匹配的模式放在括号中即可。 +可以使用捕获组(capture groups)搜寻重复的子字符串。 括号 `(` 和 `)` 可以用来匹配重复的子字符串。 把需要重复匹配的模式放在括号中即可。 -要指定重复字符串将出现的位置,可以使用反斜杠(\\)后接一个数字。 这个数字从 1 开始,随着你使用的每个捕获组的增加而增加。 这里有一个示例,`\1`可以匹配第一个组。 +要指定重复字符串将出现的位置,可以使用反斜杠(`\`)后接一个数字。 这个数字从 1 开始,随着你使用的每个捕获组的增加而增加。 这里有一个示例,`\1` 可以匹配第一个组。 下面的示例展示的是匹配被空格隔开的两个相同单词: ```js let repeatStr = "regex regex"; let repeatRegex = /(\w+)\s\1/; -repeatRegex.test(repeatStr); // Returns true -repeatStr.match(repeatRegex); // Returns ["regex regex", "regex"] +repeatRegex.test(repeatStr); +repeatStr.match(repeatRegex); ``` -在字符串上调用 `.match()` 方法将返回一个数组,其中包含它最终匹配到的字符串及其捕获组。 +`test` 调用将返回 `true`,`match` 调用将返回 `["regex regex", "regex"]`。 + +在字符串上调用 `.match()` 方法将返回一个数组,其中包含它最终匹配到的字符串及其捕获组。 # --instructions-- -Use capture groups in `reRegex` to match a string that consists of only the same number repeated exactly three times separated by single spaces. +在 `reRegex` 中使用捕获组来匹配一个只由相同的数字重复三次组成的由空格分隔字符串。 # --hints-- @@ -37,49 +39,49 @@ Use capture groups in `reRegex` to match a string that consists of only the same assert(reRegex.source.match(/\\d/)); ``` -你的正则表达式应该使用两次捕获组。 +你的正则表达式应该使用捕获组两次。 ```js assert(reRegex.source.match(/\\1|\\2/g).length >= 2); ``` -Your regex should match `"42 42 42"`. +你的正则表达式应该匹配字符串 `42 42 42`。 ```js assert(reRegex.test('42 42 42')); ``` -Your regex should match `"100 100 100"`. +你的正则表达式应该匹配字符串 `100 100 100`。 ```js assert(reRegex.test('100 100 100')); ``` -Your regex should not match `"42 42 42 42"`. +你的正则表达式不应匹配字符串 `42 42 42 42`。 ```js assert.equal('42 42 42 42'.match(reRegex.source), null); ``` -Your regex should not match `"42 42"`. +你的正则表达式不应该匹配字符串 `42 42`。 ```js assert.equal('42 42'.match(reRegex.source), null); ``` -Your regex should not match `"101 102 103"`. +你的正则表达式不应该匹配字符串 `101 102 103`。 ```js assert(!reRegex.test('101 102 103')); ``` -Your regex should not match `"1 2 3"`. +你的正则表达式不应匹配字符串 `1 2 3`。 ```js assert(!reRegex.test('1 2 3')); ``` -Your regex should match `"10 10 10"`. +你的正则表达式不应匹配字符串 `10 10 10`。 ```js assert(reRegex.test('10 10 10')); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/boo-who.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/boo-who.md index 8194f99201..aa144da373 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/boo-who.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/boo-who.md @@ -8,67 +8,67 @@ dashedName: boo-who # --description-- -Comprueba si el valor está clasificado como booleano primitivo. Devuelve verdadero o falso. +Comprueba si el valor está clasificado como booleano primitivo. Devuelve `true` o `false`. -Los booleanos primitivos son verdaderos y falsos. +Booleanos primitivos son `true` y `false`. # --hints-- -`booWho(true)` debe devolver true. +`booWho(true)` debe devolver `true`. ```js assert.strictEqual(booWho(true), true); ``` -`booWho(false)` debe devolver true. +`booWho(false)` debe devolver `true`. ```js assert.strictEqual(booWho(false), true); ``` -`booWho([1, 2, 3])` debe devolver false. +`booWho([1, 2, 3])` debe devolver `false`. ```js assert.strictEqual(booWho([1, 2, 3]), false); ``` -`booWho([].slice)` debe devolver false. +`booWho([].slice)` debe devolver `false`. ```js assert.strictEqual(booWho([].slice), false); ``` -`booWho({ "a": 1 })` debe devolver false. +`booWho({ "a": 1 })` debe devolver `false`. ```js assert.strictEqual(booWho({ a: 1 }), false); ``` -`booWho(1)` debe devolver false. +`booWho(1)` debe devolver `false`. ```js assert.strictEqual(booWho(1), false); ``` -`booWho(NaN)` debe devolver false. +`booWho(NaN)` debe devolver `false`. ```js assert.strictEqual(booWho(NaN), false); ``` -`booWho("a")` debe devolver false. +`booWho("a")` debe devolver `false`. ```js assert.strictEqual(booWho('a'), false); ``` -`booWho("true")` debe devolver falso. +`booWho("true")` debe devolver `false`. ```js assert.strictEqual(booWho('true'), false); ``` -`booWho("false")` debe devolver false. +`booWho("false")` debe devolver `false`. ```js assert.strictEqual(booWho('false'), false); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md index 2ee2ca3712..fcc5730e03 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md @@ -1,6 +1,6 @@ --- id: acda2fb1324d9b0fa741e6b5 -title: Confirm the Ending +title: Confirma el final challengeType: 5 forumTopicId: 16006 dashedName: confirm-the-ending @@ -8,31 +8,31 @@ dashedName: confirm-the-ending # --description-- -Check if a string (first argument, `str`) ends with the given target string (second argument, `target`). +Evalúa si una cadena (primer argumento, `str`) termina con la cadena de destino dada (segundo argumento, `target`). -This challenge *can* be solved with the `.endsWith()` method, which was introduced in ES2015. But for the purpose of this challenge, we would like you to use one of the JavaScript substring methods instead. +Este desafío *puede* resolverse con el método `.endsWith()`, que fue introducido en ES2015. Pero para el propósito de este desafío, nos gustaría que usaras uno de los métodos de subcadena de JavaScript en su lugar. # --hints-- -`confirmEnding("Bastian", "n")` should return true. +`confirmEnding("Bastian", "n")` debe devolver `true`. ```js assert(confirmEnding('Bastian', 'n') === true); ``` -`confirmEnding("Congratulation", "on")` should return true. +`confirmEnding("Congratulation", "on")` debe devolver `true`. ```js assert(confirmEnding('Congratulation', 'on') === true); ``` -`confirmEnding("Connor", "n")` should return false. +`confirmEnding("Connor", "n")` debe devolver `false`. ```js assert(confirmEnding('Connor', 'n') === false); ``` -`confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification")` should return false. +`confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification")` debe devolver `false`. ```js assert( @@ -43,31 +43,31 @@ assert( ); ``` -`confirmEnding("He has to give me a new name", "name")` should return true. +`confirmEnding("He has to give me a new name", "name")` debe devolver `true`. ```js assert(confirmEnding('He has to give me a new name', 'name') === true); ``` -`confirmEnding("Open sesame", "same")` should return true. +`confirmEnding("Open sesame", "same")` debe devolver `true`. ```js assert(confirmEnding('Open sesame', 'same') === true); ``` -`confirmEnding("Open sesame", "sage")` should return false. +`confirmEnding("Open sesame", "sage")` debe devolver `false`. ```js assert(confirmEnding('Open sesame', 'sage') === false); ``` -`confirmEnding("Open sesame", "game")` should return false. +`confirmEnding("Open sesame", "game")` debe devolver `false`. ```js assert(confirmEnding('Open sesame', 'game') === false); ``` -`confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain")` should return false. +`confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain")` debe devolver `false`. ```js assert( @@ -78,13 +78,13 @@ assert( ); ``` -`confirmEnding("Abstraction", "action")` should return true. +`confirmEnding("Abstraction", "action")` debe devolver `true`. ```js assert(confirmEnding('Abstraction', 'action') === true); ``` -Your code should not use the built-in method `.endsWith()` to solve the challenge. +Tu código no debe usar el método incorporado `.endsWith()` para resolver el desafío. ```js assert(!/\.endsWith\(.*?\)\s*?;?/.test(code) && !/\['endsWith'\]/.test(code)); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/factorialize-a-number.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/factorialize-a-number.md index ce2b6f6a2d..1b3ba8af3c 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/factorialize-a-number.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/factorialize-a-number.md @@ -1,6 +1,6 @@ --- id: a302f7aae1aa3152a5b413bc -title: Factorializar un número +title: Factoriza un número challengeType: 5 forumTopicId: 16013 dashedName: factorialize-a-number @@ -10,13 +10,13 @@ dashedName: factorialize-a-number Devuelve el factorial del entero proporcionado. -Si el entero está representado con la letra n, un factorial es el producto de todos los enteros positivos menores o iguales a n. +Si el número entero es representado con la letra `n`, un factorial es el producto de todos los enteros positivos menores o iguales a `n`. -¡Los factoriales suelen representarse con la abreviatura `n!` +Los factoriales suelen representarse con la abreviatura `n!` Por ejemplo: `5! = 1 * 2 * 3 * 4 * 5 = 120` -Sólo se proporcionara a la función enteros mayores o igual a cero. +Sólo se proporcionarán a la función los enteros mayores o iguales a cero. # --hints-- @@ -26,25 +26,25 @@ Sólo se proporcionara a la función enteros mayores o igual a cero. assert(typeof factorialize(5) === 'number'); ``` -`factorialize(5)` debe devolver 120. +`factorialize(5)` debe devolver `120`. ```js assert(factorialize(5) === 120); ``` -`factorialize(10)` debe devolver 3628800. +`factorialize(10)` debe devolver `3628800`. ```js assert(factorialize(10) === 3628800); ``` -`factorialize(20)` debe devolver 2432902008176640000. +`factorialize(20)` debe devolver `2432902008176640000`. ```js assert(factorialize(20) === 2432902008176640000); ``` -`factorialize(0)` debe devolver 1. +`factorialize(0)` debe devolver `1`. ```js assert(factorialize(0) === 1); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/find-the-longest-word-in-a-string.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/find-the-longest-word-in-a-string.md index ab10198903..7bcd6cf38b 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/find-the-longest-word-in-a-string.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/find-the-longest-word-in-a-string.md @@ -24,7 +24,7 @@ assert( ); ``` -`findLongestWordLength("The quick brown fox jumped over the lazy dog")` debe devolver 6. +`findLongestWordLength("The quick brown fox jumped over the lazy dog")` debe devolver `6`. ```js assert( @@ -32,19 +32,19 @@ assert( ); ``` -`findLongestWordLength("May the force be with you")` debe devolver 5. +`findLongestWordLength("May the force be with you")` debe devolver `5`. ```js assert(findLongestWordLength('May the force be with you') === 5); ``` -`findLongestWordLength("Google do a barrel roll")` debe devolver 6. +`findLongestWordLength("Google do a barrel roll")` debe devolver `6`. ```js assert(findLongestWordLength('Google do a barrel roll') === 6); ``` -`findLongestWordLength("What is the average airspeed velocity of an unladen swallow")` debe devolver 8. +`findLongestWordLength("What is the average airspeed velocity of an unladen swallow")` debe devolver `8`. ```js assert( @@ -54,7 +54,7 @@ assert( ); ``` -`findLongestWordLength("What if we try a super-long word such as otorhinolaryngology")` debe devolver 19. +`findLongestWordLength("What if we try a super-long word such as otorhinolaryngology")` debe devolver `19`. ```js assert( diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/finders-keepers.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/finders-keepers.md index 30740f5673..d51fa501c8 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/finders-keepers.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/finders-keepers.md @@ -12,7 +12,7 @@ Crea una función que recorra un arreglo `arr` y devuelva el primer elemento que # --hints-- -`findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; })` debería devolver 8. +`findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; })` debe devolver `8`. ```js assert.strictEqual( @@ -23,7 +23,7 @@ assert.strictEqual( ); ``` -`findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; })` debería devolver undefined. +`findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; })` debe devolver `undefined`. ```js assert.strictEqual( diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations.md index a3b6017238..387585f242 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations.md @@ -1,6 +1,6 @@ --- id: af2170cad53daa0770fabdea -title: Mutations +title: Mutaciones challengeType: 5 forumTopicId: 16025 dashedName: mutations @@ -8,83 +8,83 @@ dashedName: mutations # --description-- -Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array. +Devuelve `true` si la cadena de caracteres en el primer elemento del arreglo contiene todas las letras de la cadena en el segundo elemento del arreglo. -For example, `["hello", "Hello"]`, should return true because all of the letters in the second string are present in the first, ignoring case. +Por ejemplo, `["hello", "Hello"]`, debe devolver `true` porque todas las letras de la segunda cadena están presentes en la primera, ignorando mayúsculas o minúsculas. -The arguments `["hello", "hey"]` should return false because the string "hello" does not contain a "y". +Los argumentos `["hello", "hey"]` deben devolver `false` porque la cadena `hello` no contiene `y`. -Lastly, `["Alien", "line"]`, should return true because all of the letters in "line" are present in "Alien". +Finalmente, `["Alien", "line"]`, debe devolver `true` porque todas las letras de `line` están presentes en `Alien`. # --hints-- -`mutation(["hello", "hey"])` should return false. +`mutation(["hello", "hey"])` debe devolver `false`. ```js assert(mutation(['hello', 'hey']) === false); ``` -`mutation(["hello", "Hello"])` should return true. +`mutation(["hello", "Hello"])` debe devolver `true`. ```js assert(mutation(['hello', 'Hello']) === true); ``` -`mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"])` should return true. +`mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"])` debe devolver `true`. ```js assert(mutation(['zyxwvutsrqponmlkjihgfedcba', 'qrstu']) === true); ``` -`mutation(["Mary", "Army"])` should return true. +`mutation(["Mary", "Army"])` debe devolver `true`. ```js assert(mutation(['Mary', 'Army']) === true); ``` -`mutation(["Mary", "Aarmy"])` should return true. +`mutation(["Mary", "Aarmy"])` debe devolver `true`. ```js assert(mutation(['Mary', 'Aarmy']) === true); ``` -`mutation(["Alien", "line"])` should return true. +`mutation(["Alien", "line"])` debe devolver `true`. ```js assert(mutation(['Alien', 'line']) === true); ``` -`mutation(["floor", "for"])` should return true. +`mutation(["floor", "for"])` debe devolver `true`. ```js assert(mutation(['floor', 'for']) === true); ``` -`mutation(["hello", "neo"])` should return false. +`mutation(["hello", "neo"])` debe devolver `false`. ```js assert(mutation(['hello', 'neo']) === false); ``` -`mutation(["voodoo", "no"])` should return false. +`mutation(["voodoo", "no"])` debe devolver `false`. ```js assert(mutation(['voodoo', 'no']) === false); ``` -`mutation(["ate", "date"]` should return false. +`mutation(["ate", "date"])` debe devolver `false`. ```js assert(mutation(['ate', 'date']) === false); ``` -`mutation(["Tiger", "Zebra"])` should return false. +`mutation(["Tiger", "Zebra"])` debe devolver `false`. ```js assert(mutation(['Tiger', 'Zebra']) === false); ``` -`mutation(["Noel", "Ole"])` should return true. +`mutation(["Noel", "Ole"])` debe devolver `true`. ```js assert(mutation(['Noel', 'Ole']) === true); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md index 8dbc000a4d..94c0adc84f 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md @@ -1,6 +1,6 @@ --- id: afcc8d540bea9ea2669306b6 -title: Repetir una cadena repetir una cadena +title: Repite una cadena repite una cadena challengeType: 5 forumTopicId: 16041 dashedName: repeat-a-string-repeat-a-string @@ -8,47 +8,47 @@ dashedName: repeat-a-string-repeat-a-string # --description-- -Repita una cadena dada `str` (primer argumento) por `num` veces (segundo argumento). Retorne una cadena vacía si `num` no es un número positivo. Para este desafío, utiliza *not* el método `.repeat()` incorporado. +Repite una cadena dada `str` (primer argumento) por un número (`num`) de veces (segundo argumento). Devuelve una cadena vacía si `num` no es un número positivo. Para este desafío, *no* utilices el método incorporado `.repeat()`. # --hints-- -`repeatStringNumTimes("*", 3)` debe devolver `"***"`. +`repeatStringNumTimes("*", 3)` debe devolver la cadena `***`. ```js assert(repeatStringNumTimes('*', 3) === '***'); ``` -`repeatStringNumTimes("abc", 3)` debe devolver `"abcabcabc"`. +`repeatStringNumTimes("abc", 3)` debe devolver la cadena `abcabcabc`. ```js assert(repeatStringNumTimes('abc', 3) === 'abcabcabc'); ``` -`repeatStringNumTimes("abc", 4)` debe devolver `"abcabcabcabc"`. +`repeatStringNumTimes("abc", 4)` debe devolver la cadena `abcabcabcabc`. ```js assert(repeatStringNumTimes('abc', 4) === 'abcabcabcabc'); ``` -`repeatStringNumTimes("abc", 1)` debe devolver `"abc"`. +`repeatStringNumTimes("abc", 1)` debe devolver la cadena `abc`. ```js assert(repeatStringNumTimes('abc', 1) === 'abc'); ``` -`repeatStringNumTimes("*", 8)` debe devolver `"********"`. +`repeatStringNumTimes("*", 8)` debe devolver la cadena `********`. ```js assert(repeatStringNumTimes('*', 8) === '********'); ``` -`repeatStringNumTimes("abc", -2)` debe devolver `""`. +`repeatStringNumTimes("abc", -2)` debe devolver una cadena vacía (`""`). ```js assert(repeatStringNumTimes('abc', -2) === ''); ``` -El método integrado `repeat()` no debe ser utilizado. +El método incorporado `repeat()` no debe ser utilizado. ```js assert(!/\.repeat/g.test(code)); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string.md index 157d19e1b6..250f426e29 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string.md @@ -1,6 +1,6 @@ --- id: a202eed8fc186c8434cb6d61 -title: Invertir una Cadena +title: Invierte una cadena challengeType: 5 forumTopicId: 16043 dashedName: reverse-a-string @@ -8,33 +8,33 @@ dashedName: reverse-a-string # --description-- -Invertir la cadena provista. +Invierte la cadena proporcionada. -Es posible que necesites convertir la cadena en una matriz antes de poder invertirla. +Es posible que necesites convertir la cadena en un arreglo antes de poder invertirla. -Tu resultado deber ser una cadena. +Tu resultado debe ser una cadena. # --hints-- -`reverseString("hello")` debería devolver una cadena. +`reverseString("hello")` debe devolver una cadena. ```js assert(typeof reverseString('hello') === 'string'); ``` -`reverseString("hello")` debería convertirse en `"olleh"`. +`reverseString("hello")` debe devolver la cadena `olleh`. ```js assert(reverseString('hello') === 'olleh'); ``` -`reverseString("Howdy")` debería convertirse en `"ydwoH"`. +`reverseString("Howdy")` debe devolver la cadena `ydwoH`. ```js assert(reverseString('Howdy') === 'ydwoH'); ``` -`reverseString("Greetings from Earth")` debería devolver `"htraE morf sgniteerG"`. +`reverseString("Greetings from Earth")` debe devolver la cadena `htraE morf sgniteerG`. ```js assert(reverseString('Greetings from Earth') === 'htraE morf sgniteerG'); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/title-case-a-sentence.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/title-case-a-sentence.md index bc8541834f..9ab45ec45f 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/title-case-a-sentence.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/title-case-a-sentence.md @@ -8,9 +8,9 @@ dashedName: title-case-a-sentence # --description-- -Devuelve la cadena proporcionada con la primera letra de cada palabra en mayúsculas. Asegúrese de que el resto de la palabra esté en minúsculas. +Devuelve la cadena proporcionada con la primera letra de cada palabra en mayúsculas. Asegúrate de que el resto de la palabra esté en minúsculas. -Para este ejercicio, también debes usar mayúsculas en los conectores como "the" y "of". +Como propósito de este ejercicio, debes también usar mayúsculas conectando palabras como `the` y `of`. # --hints-- @@ -20,19 +20,19 @@ Para este ejercicio, también debes usar mayúsculas en los conectores como "the assert(typeof titleCase("I'm a little tea pot") === 'string'); ``` -`titleCase("I'm a little tea pot")` debe devolver `I'm A Little Tea Pot`. +`titleCase("I'm a little tea pot")` debe devolver la cadena `I'm A Little Tea Pot`. ```js assert(titleCase("I'm a little tea pot") === "I'm A Little Tea Pot"); ``` -`titleCase("sHoRt AnD sToUt")` debe devolver `Short And Stout`. +`titleCase("sHoRt AnD sToUt")` debe devolver la cadena `Short And Stout`. ```js assert(titleCase('sHoRt AnD sToUt') === 'Short And Stout'); ``` -`titleCase("HERE IS MY HANDLE HERE IS MY SPOUT")` debe devolver `Here Is My Handle Here Is My Spout`. +`titleCase("HERE IS MY HANDLE HERE IS MY SPOUT")` debe devolver la cadena `Here Is My Handle Here Is My Spout`. ```js assert( diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/truncate-a-string.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/truncate-a-string.md index c32c069878..c6473f40da 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/truncate-a-string.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/truncate-a-string.md @@ -1,6 +1,6 @@ --- id: ac6993d51946422351508a41 -title: Truncate a String +title: Recorta una cadena challengeType: 5 forumTopicId: 16089 dashedName: truncate-a-string @@ -8,11 +8,11 @@ dashedName: truncate-a-string # --description-- -Truncate a string (first argument) if it is longer than the given maximum string length (second argument). Return the truncated string with a `...` ending. +Recorta una cadena (primer argumento) si es más larga que la longitud máxima proporcionada (segundo argumento). Devuelve la cadena recortada con un `...` al final. # --hints-- -`truncateString("A-tisket a-tasket A green and yellow basket", 8)` should return "A-tisket...". +`truncateString("A-tisket a-tasket A green and yellow basket", 8)` debe devolver la cadena `A-tisket...`. ```js assert( @@ -21,7 +21,7 @@ assert( ); ``` -`truncateString("Peter Piper picked a peck of pickled peppers", 11)` should return "Peter Piper...". +`truncateString("Peter Piper picked a peck of pickled peppers", 11)` debe devolver la cadena `Peter Piper...`. ```js assert( @@ -30,7 +30,7 @@ assert( ); ``` -`truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length)` should return "A-tisket a-tasket A green and yellow basket". +`truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length)` debe devolver la cadena `A-tisket a-tasket A green and yellow basket`. ```js assert( @@ -41,7 +41,7 @@ assert( ); ``` -`truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length + 2)` should return "A-tisket a-tasket A green and yellow basket". +`truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length + 2)` debe devolver la cadena `A-tisket a-tasket A green and yellow basket`. ```js assert( @@ -52,13 +52,13 @@ assert( ); ``` -`truncateString("A-", 1)` should return "A...". +`truncateString("A-", 1)` debe devolver la cadena `A...`. ```js assert(truncateString('A-', 1) === 'A...'); ``` -`truncateString("Absolutely Longer", 2)` should return "Ab...". +`truncateString("Absolutely Longer", 2)` debe devolver la cadena `Ab...`. ```js assert(truncateString('Absolutely Longer', 2) === 'Ab...'); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/access-an-arrays-contents-using-bracket-notation.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/access-an-arrays-contents-using-bracket-notation.md index 482d2c5236..78a6c48c76 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/access-an-arrays-contents-using-bracket-notation.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/access-an-arrays-contents-using-bracket-notation.md @@ -1,6 +1,6 @@ --- id: 5a661e0f1068aca922b3ef17 -title: Access an Array's Contents Using Bracket Notation +title: Accede a los contenidos de un arreglo utilizando la notación de corchetes challengeType: 1 forumTopicId: 301149 dashedName: access-an-arrays-contents-using-bracket-notation @@ -8,55 +8,55 @@ dashedName: access-an-arrays-contents-using-bracket-notation # --description-- -The fundamental feature of any data structure is, of course, the ability to not only store data, but to be able to retrieve that data on command. So, now that we've learned how to create an array, let's begin to think about how we can access that array's information. +La principal característica de cualquier estructura de datos es, por supuesto, la habilidad no solo de guardar datos, sino también de ser capaz de recuperar esos datos cuando le es requerido. Entonces, ahora que hemos aprendido como crear un arreglo, comencemos a pensar en cómo podemos acceder a la información de ese arreglo. -When we define a simple array as seen below, there are 3 items in it: +Cuando definimos un arreglo simple como el que se ve a continuación, hay 3 elementos en él: ```js let ourArray = ["a", "b", "c"]; ``` -In an array, each array item has an index. This index doubles as the position of that item in the array, and how you reference it. However, it is important to note, that JavaScript arrays are zero-indexed, meaning that the first element of an array is actually at the ***zeroth*** position, not the first. In order to retrieve an element from an array we can enclose an index in brackets and append it to the end of an array, or more commonly, to a variable which references an array object. This is known as bracket notation. For example, if we want to retrieve the `"a"` from `ourArray` and assign it to a variable, we can do so with the following code: +En un arreglo, cada elemento tiene un índice. Este índice funciona como la posición de ese elemento en el arreglo y es como puedes referenciarlo. Sin embargo, es importante tener en cuenta, que los arreglos en JavaScript son indexados en base cero, es decir que el primer elemento de un arreglo está en la posición ***cero***, no en la uno. Para recuperar un elemento de un arreglo podemos encerrar un índice entre corchetes y agregarlo al final de este, o más comúnmente, a una variable que hace referencia a un objeto tipo arreglo. Esto es conocido como notación de corchetes. Por ejemplo, si queremos recuperar la `a` de `ourArray` y asignársela a una variable, podemos hacerlo con el siguiente código: ```js let ourVariable = ourArray[0]; -// ourVariable equals "a" ``` -In addition to accessing the value associated with an index, you can also *set* an index to a value using the same notation: +Ahora `ourVariable` tiene el valor de `a`. + +Además de acceder al valor asociado con un índice, también puedes *establecer* un índice a un valor usando la misma notación: ```js ourArray[1] = "not b anymore"; -// ourArray now equals ["a", "not b anymore", "c"]; ``` -Using bracket notation, we have now reset the item at index 1 from `"b"`, to `"not b anymore"`. +Utilizando la notación de corchetes, ahora hemos restablecido el elemento en el índice 1 de la cadena `b`, a `not b anymore`. Ahora `ourArray` es `["a", "not b anymore", "c"]`. # --instructions-- -In order to complete this challenge, set the 2nd position (index `1`) of `myArray` to anything you want, besides `"b"`. +Para completar este desafío, establece la segunda posición (índice `1`) de `myArray` a cualquier cosa que quieras, además de la letra `b`. # --hints-- -`myArray[0]` should be equal to `"a"` +`myArray[0]` debe ser igual a la letra `a` ```js assert.strictEqual(myArray[0], 'a'); ``` -`myArray[1]` should not be equal to `"b"` +`myArray[1]` no debe ser igual a la letra `b` ```js assert.notStrictEqual(myArray[1], 'b'); ``` -`myArray[2]` should be equal to `"c"` +`myArray[2]`debe ser igual a la letra `c` ```js assert.strictEqual(myArray[2], 'c'); ``` -`myArray[3]` should be equal to `"d"` +`myArray[3]` debe ser igual a la letra `d` ```js assert.strictEqual(myArray[3], 'd'); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-to-an-array-with-push-and-unshift.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-to-an-array-with-push-and-unshift.md index afd8dff124..d1746ef9a3 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-to-an-array-with-push-and-unshift.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-to-an-array-with-push-and-unshift.md @@ -1,6 +1,6 @@ --- id: 587d78b2367417b2b2512b0e -title: Add Items to an Array with push() and unshift() +title: Agrega elementos a un arreglo con push() y unshift() challengeType: 1 forumTopicId: 301151 dashedName: add-items-to-an-array-with-push-and-unshift @@ -8,28 +8,32 @@ dashedName: add-items-to-an-array-with-push-and-unshift # --description-- -An array's length, like the data types it can contain, is not fixed. Arrays can be defined with a length of any number of elements, and elements can be added or removed over time; in other words, arrays are mutable. In this challenge, we will look at two methods with which we can programmatically modify an array: `Array.push()` and `Array.unshift()`. +La longitud de un arreglo, así como los tipos de datos que puede contener, no es fija. Los arreglos pueden ser definidos con la cantidad de elementos que se desee, y dichos elementos pueden ser agregados o removidos con el tiempo; en otras palabras, los arreglos son mutables. En este desafío, veremos dos métodos con los que podemos modificar un arreglo: `Array.push()` y `Array.unshift()`. -Both methods take one or more elements as parameters and add those elements to the array the method is being called on; the `push()` method adds elements to the end of an array, and `unshift()` adds elements to the beginning. Consider the following: +Ambos métodos toman uno o más elementos como parámetros y los agregan al arreglo que hizo la llamada; el método `push()` agrega los elementos al final del arreglo, mientras que `unshift()` los agrega al inicio. Considera lo siguiente: ```js let twentyThree = 'XXIII'; let romanNumerals = ['XXI', 'XXII']; romanNumerals.unshift('XIX', 'XX'); -// now equals ['XIX', 'XX', 'XXI', 'XXII'] - -romanNumerals.push(twentyThree); -// now equals ['XIX', 'XX', 'XXI', 'XXII', 'XXIII']Notice that we can also pass variables, which allows us even greater flexibility in dynamically modifying our array's data. ``` +`romanNumerals` tendrá el valor `['XIX', 'XX', 'XXI', 'XXII']`. + +```js +romanNumerals.push(twentyThree); +``` + +`romanNumerals` tendrá el valor `['XIX', 'XX', 'XXI', 'XXII', 'XXIII']`. Ten en cuenta que también podemos pasar variables, que nos permiten una mayor flexibilidad en la modificación dinámica de los datos de nuestro arreglo. + # --instructions-- -We have defined a function, `mixedNumbers`, which we are passing an array as an argument. Modify the function by using `push()` and `unshift()` to add `'I', 2, 'three'` to the beginning of the array and `7, 'VIII', 9` to the end so that the returned array contains representations of the numbers 1-9 in order. +Hemos definido una función, `mixedNumbers`, a la cual le estamos pasando un arreglo como argumento. Modifica la función utilizando `push()` y `unshift()` para agregar `'I', 2, 'three'` al principio del arreglo y `7, 'VIII', 9` al final, de tal modo que el arreglo devuelto contenga las representaciones de los números del 1 al 9 en orden. # --hints-- -`mixedNumbers(["IV", 5, "six"])` should now return `["I", 2, "three", "IV", 5, "six", 7, "VIII", 9]` +`mixedNumbers(["IV", 5, "six"])` ahora debe devolver `["I", 2, "three", "IV", 5, "six", 7, "VIII", 9]` ```js assert.deepEqual(mixedNumbers(['IV', 5, 'six']), [ @@ -45,13 +49,13 @@ assert.deepEqual(mixedNumbers(['IV', 5, 'six']), [ ]); ``` -The `mixedNumbers` function should utilize the `push()` method +La función `mixedNumbers` debe utilizar el método `push()` ```js assert(mixedNumbers.toString().match(/\.push/)); ``` -The `mixedNumbers` function should utilize the `unshift()` method +La función `mixedNumbers` debe utilizar el método `unshift()` ```js assert(mixedNumbers.toString().match(/\.unshift/)); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md index 04a8878555..1bb857728f 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md @@ -1,6 +1,6 @@ --- id: 587d78b3367417b2b2512b11 -title: Add Items Using splice() +title: Agrega elementos usando splice() challengeType: 1 forumTopicId: 301152 dashedName: add-items-using-splice @@ -8,7 +8,7 @@ dashedName: add-items-using-splice # --description-- -Remember in the last challenge we mentioned that `splice()` can take up to three parameters? Well, you can use the third parameter, comprised of one or more element(s), to add to the array. This can be incredibly useful for quickly switching out an element, or a set of elements, for another. +¿Recuerdas que en el último desafío mencionamos que `splice()` puede tomar hasta tres parámetros? Pues bien, puedes usar el tercer parámetro, compuesto por uno o varios elementos, para agregarlo al arreglo. Esto puede ser increíblemente útil para cambiar rápidamente un elemento, o un conjunto de elementos, por otro. ```js const numbers = [10, 11, 12, 12, 15]; @@ -16,20 +16,20 @@ const startIndex = 3; const amountToDelete = 1; numbers.splice(startIndex, amountToDelete, 13, 14); -// the second entry of 12 is removed, and we add 13 and 14 at the same index console.log(numbers); -// returns [ 10, 11, 12, 13, 14, 15 ] ``` -Here, we begin with an array of numbers. Then, we pass the following to `splice()`: The index at which to begin deleting elements (3), the number of elements to be deleted (1), and the remaining arguments (13, 14) will be inserted starting at that same index. Note that there can be any number of elements (separated by commas) following `amountToDelete`, each of which gets inserted. +La segunda entrada de `12` es removida, y agregamos `13` y `14` en el mismo índice. El arreglo `numbers` ahora será `[ 10, 11, 12, 13, 14, 15 ]`. + +Aquí, comenzamos con un arreglo de números. A continuación, pasamos lo siguiente a `splice()`: El índice en el que empezar a borrar elementos (3), el número de elementos a borrar (1), y el resto de argumentos (13, 14) se insertarán a partir de ese mismo índice. Ten en cuenta que puede haber cualquier número de elementos (separados por comas) después de `amountToDelete`, cada uno de los cuales es insertado. # --instructions-- -We have defined a function, `htmlColorNames`, which takes an array of HTML colors as an argument. Modify the function using `splice()` to remove the first two elements of the array and add `'DarkSalmon'` and `'BlanchedAlmond'` in their respective places. +Hemos definido una función, `htmlColorNames`, que toma un arreglo de colores HTML como argumento. Modifica la función usando `splice()` para eliminar los dos primeros elementos del arreglo y agrega `'DarkSalmon'` y `'BlanchedAlmond'` en sus respectivos lugares. # --hints-- -`htmlColorNames` should return `["DarkSalmon", "BlanchedAlmond", "LavenderBlush", "PaleTurquoise", "FireBrick"]` +`htmlColorNames` debe devolver `["DarkSalmon", "BlanchedAlmond", "LavenderBlush", "PaleTurquoise", "FireBrick"]` ```js assert.deepEqual( @@ -50,19 +50,19 @@ assert.deepEqual( ); ``` -The `htmlColorNames` function should utilize the `splice()` method +La función `htmlColorNames` debe utilizar el método `splice()` ```js assert(/.splice/.test(code)); ``` -You should not use `shift()` or `unshift()`. +No debes usar `shift()` o `unshift()`. ```js assert(!/shift|unshift/.test(code)); ``` -You should not use array bracket notation. +No debes usar notación de corchetes. ```js assert(!/\[\d\]\s*=/.test(code)); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md index 6ed7fab4fa..13b8051994 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md @@ -63,19 +63,19 @@ Se ha creado un objeto `foods` con tres entradas. Usando la sintaxis de tu elecc assert(typeof foods === 'object'); ``` -El objeto `foods` debe tener una clave `"bananas"` con el valor de `13`. +El objeto `foods` debe tener una clave `bananas` con el valor de `13`. ```js assert(foods.bananas === 13); ``` -El objeto `foods` debe tener una clave `"grapes"` con el valor de `35`. +El objeto `foods` debe tener una clave `grapes` con el valor de `35`. ```js assert(foods.grapes === 35); ``` -El objeto `foods` debe tener una clave `"strawberries"` con el valor de `27`. +El objeto `foods` debe tener una clave `strawberries` con el valor de `27`. ```js assert(foods.strawberries === 27); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/check-for-the-presence-of-an-element-with-indexof.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/check-for-the-presence-of-an-element-with-indexof.md index 0c80331f41..fdcf3725b0 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/check-for-the-presence-of-an-element-with-indexof.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/check-for-the-presence-of-an-element-with-indexof.md @@ -1,6 +1,6 @@ --- id: 587d7b7b367417b2b2512b14 -title: Comprobar la presencia de un elemento con indexOf() +title: Comprueba la presencia de un elemento con indexOf() challengeType: 1 forumTopicId: 301154 dashedName: check-for-the-presence-of-an-element-with-indexof @@ -15,18 +15,20 @@ Por ejemplo: ```js let fruits = ['apples', 'pears', 'oranges', 'peaches', 'pears']; -fruits.indexOf('dates'); // returns -1 -fruits.indexOf('oranges'); // returns 2 -fruits.indexOf('pears'); // returns 1, the first index at which the element exists +fruits.indexOf('dates'); +fruits.indexOf('oranges'); +fruits.indexOf('pears'); ``` +`indexOf('dates')` devuelve `-1`, `indexOf('oranges')` devuelve `2`, e `indexOf('pears')` devuelve `1` (el primer índice en el que existe cada elemento). + # --instructions-- -`indexOf()` puede ser increíblemente útil para comprobar rápidamente la presencia de un elemento en un arreglo. Hemos definido una función, `quickCheck`, que toma un arreglo y un elemento como argumentos. Modifica la función usando `indexOf()` para que devuelva `true` si el elemento pasado existe en el arreglo, y `false` si no existe. +`indexOf()` puede ser increíblemente útil para verificar rápidamente la presencia de un elemento en un arreglo. Hemos definido una función, `quickCheck`, que toma un arreglo y un elemento como argumentos. Modifica la función usando `indexOf()` para que devuelva `true` si el elemento pasado existe en el arreglo, y `false` si no existe. # --hints-- -La función `quickCheck` debe devolver un booleano (`true` o `false`), no una cadena (`"true"` o `"false"`) +La función `quickCheck` debe devolver un valor booleano (`true` o `false`), no una cadena (`"true"` o `"false"`) ```js assert.isBoolean(quickCheck(['squash', 'onions', 'shallots'], 'mushrooms')); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md index 8509df6c01..a263302683 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md @@ -13,12 +13,13 @@ Ahora podemos agregar, modificar y eliminar claves de los objetos. Pero, ¿y si ```js users.hasOwnProperty('Alan'); 'Alan' in users; -// both return true ``` +Ambos devuelven `true`. + # --instructions-- -Hemos creado un objeto, `users`, con algunos usuarios en él y una función `isEveryoneHere`, a la que pasamos el objeto `users` como argumento. Termina de escribir esta función para que devuelva `true` sólo si el objeto `users` contiene los cuatro nombres, `Alan`, `Jeff`, `Sarah` y `Ryan`, como claves, y `false` en caso contrario. +Hemos creado un objeto, `users`, con algunos usuarios en él y una función `isEveryoneHere`, a la que pasamos el objeto `users` como argumento. Termina de escribir esta función para que devuelva `true` solo si el objeto `users` contiene los cuatro nombres, `Alan`, `Jeff`, `Sarah` y `Ryan`, como claves, y `false`en caso contrario. # --hints-- @@ -34,13 +35,13 @@ assert( ); ``` -La función `isEveryoneHere` debe devolver `true` si `Alan`, `Jeff`, `Sarah`, y `Ryan` son propiedades en el objeto `users` +La función `isEveryoneHere` debe devolver `true` si `Alan`, `Jeff`, `Sarah`, y `Ryan` son propiedades del objeto `users` ```js assert(isEveryoneHere(users) === true); ``` -La función `isEveryoneHere` debe devolver `false` si `Alan` no es una propiedad en el objeto `users` +La función `isEveryoneHere` debe devolver `false` si `Alan` no es una propiedad del objeto `users` ```js assert( @@ -51,7 +52,7 @@ assert( ); ``` -La función `isEveryoneHere` debe devolver `false` si `Jeff` no es una propiedad en el objeto `users` +La función `isEveryoneHere` debe devolver `false` si `Jeff` no es una propiedad del objeto `users` ```js assert( @@ -62,7 +63,7 @@ assert( ); ``` -La función `isEveryoneHere` debe devolver `false` si `Sarah` no es una propiedad en el objeto `users` +La función `isEveryoneHere` debe devolver `false` si `Sarah` no es una propiedad del objeto `users` ```js assert( @@ -73,7 +74,7 @@ assert( ); ``` -La función `isEveryoneHere` debe devolver `false` si `Ryan` no es una propiedad en el objeto `users` +La función `isEveryoneHere` debe devolver `false` si `Ryan` no es una propiedad del objeto `users` ```js assert( diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/combine-arrays-with-the-spread-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/combine-arrays-with-the-spread-operator.md index 0a27f7bb09..0653f2ae04 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/combine-arrays-with-the-spread-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/combine-arrays-with-the-spread-operator.md @@ -1,6 +1,6 @@ --- id: 587d7b7b367417b2b2512b17 -title: Combine Arrays with the Spread Operator +title: Combina arreglos con el operador de propagación challengeType: 1 forumTopicId: 301156 dashedName: combine-arrays-with-the-spread-operator @@ -8,30 +8,31 @@ dashedName: combine-arrays-with-the-spread-operator # --description-- -Another huge advantage of the spread operator, is the ability to combine arrays, or to insert all the elements of one array into another, at any index. With more traditional syntaxes, we can concatenate arrays, but this only allows us to combine arrays at the end of one, and at the start of another. Spread syntax makes the following operation extremely simple: +Otra gran ventaja del operador de propagación es la capacidad de combinar arreglos, o de insertar todos los elementos de un arreglo en otro, en cualquier índice. Con sintaxis más tradicionales, podemos concatenar arreglos, pero esto sólo nos permite combinar arreglos al final de uno, y al principio de otro. La sintaxis de propagación hace la siguiente operación extremadamente simple: ```js let thisArray = ['sage', 'rosemary', 'parsley', 'thyme']; let thatArray = ['basil', 'cilantro', ...thisArray, 'coriander']; -// thatArray now equals ['basil', 'cilantro', 'sage', 'rosemary', 'parsley', 'thyme', 'coriander'] ``` -Using spread syntax, we have just achieved an operation that would have been more complex and more verbose had we used traditional methods. +`thatArray` tendrá el valor `['basil', 'cilantro', 'sage', 'rosemary', 'parsley', 'thyme', 'coriander']`. + +Usando la sintaxis de propagación, acabamos de lograr una operación que habría sido más compleja y verbosa si hubiéramos usado métodos tradicionales. # --instructions-- -We have defined a function `spreadOut` that returns the variable `sentence`. Modify the function using the spread operator so that it returns the array `['learning', 'to', 'code', 'is', 'fun']`. +Hemos definido una función `spreadOut` que devuelve la variable `sentence`. Modifica la función usando el operador de propagación para que devuelva el arreglo `['learning', 'to', 'code', 'is', 'fun']`. # --hints-- -`spreadOut` should return `["learning", "to", "code", "is", "fun"]` +`spreadOut` debe devolver `["learning", "to", "code", "is", "fun"]` ```js assert.deepEqual(spreadOut(), ['learning', 'to', 'code', 'is', 'fun']); ``` -The `spreadOut` function should utilize spread syntax +La función `spreadOut` debe utilizar la sintaxis de propagación ```js assert.notStrictEqual(spreadOut.toString().search(/[...]/), -1); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md index ca3aa490b5..7d1659f07d 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md @@ -1,6 +1,6 @@ --- id: 587d7b7b367417b2b2512b13 -title: Copy an Array with the Spread Operator +title: Copia un arreglo con el operador de propagación challengeType: 1 forumTopicId: 301157 dashedName: copy-an-array-with-the-spread-operator @@ -8,24 +8,24 @@ dashedName: copy-an-array-with-the-spread-operator # --description-- -While `slice()` allows us to be selective about what elements of an array to copy, among several other useful tasks, ES6's new spread operator allows us to easily copy *all* of an array's elements, in order, with a simple and highly readable syntax. The spread syntax simply looks like this: `...` +Mientras que `slice()` nos permite ser selectivos sobre qué elementos de un arreglo copiar, entre otras tareas útiles, el nuevo operador de propagación de ES6 nos permite copiar fácilmente *todos* los elementos de una arreglo, en orden, con una sintaxis simple y altamente legible. La sintaxis de propagación simplemente se ve así: `...` -In practice, we can use the spread operator to copy an array like so: +En la práctica, podemos utilizar el operador de propagación para copiar un arreglo de esta manera: ```js let thisArray = [true, true, undefined, false, null]; let thatArray = [...thisArray]; -// thatArray equals [true, true, undefined, false, null] -// thisArray remains unchanged and thatArray contains the same elements as thisArray ``` +`thatArray` es igual a `[true, true, undefined, false, null]`. `thisArray` permanece sin cambios y `thatArray` contiene los mismos elementos que `thisArray`. + # --instructions-- -We have defined a function, `copyMachine` which takes `arr` (an array) and `num` (a number) as arguments. The function is supposed to return a new array made up of `num` copies of `arr`. We have done most of the work for you, but it doesn't work quite right yet. Modify the function using spread syntax so that it works correctly (hint: another method we have already covered might come in handy here!). +Hemos definido una función, `copyMachine` que toma `arr` (un arreglo) y `num` (un número) como argumentos. Se supone que la función devuelve un nuevo arreglo compuesto por `num` copias de `arr`. Hemos hecho la mayor parte del trabajo por ti, pero aún no funciona del todo bien. Modifica la función usando sintaxis de propagación para que funcione correctamente (sugerencia: ¡otro método que ya hemos cubierto podría ser útil aquí!). # --hints-- -`copyMachine([true, false, true], 2)` should return `[[true, false, true], [true, false, true]]` +`copyMachine([true, false, true], 2)` debe devolver `[[true, false, true], [true, false, true]]` ```js assert.deepEqual(copyMachine([true, false, true], 2), [ @@ -34,7 +34,7 @@ assert.deepEqual(copyMachine([true, false, true], 2), [ ]); ``` -`copyMachine([1, 2, 3], 5)` should return `[[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]]` +`copyMachine([1, 2, 3], 5)` debe devolver `[[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]]` ```js assert.deepEqual(copyMachine([1, 2, 3], 5), [ @@ -46,13 +46,13 @@ assert.deepEqual(copyMachine([1, 2, 3], 5), [ ]); ``` -`copyMachine([true, true, null], 1)` should return `[[true, true, null]]` +`copyMachine([true, true, null], 1)` debe devolver `[[true, true, null]]` ```js assert.deepEqual(copyMachine([true, true, null], 1), [[true, true, null]]); ``` -`copyMachine(["it works"], 3)` should return `[["it works"], ["it works"], ["it works"]]` +`copyMachine(["it works"], 3)` debe devolver `[["it works"], ["it works"], ["it works"]]` ```js assert.deepEqual(copyMachine(['it works'], 3), [ @@ -62,7 +62,7 @@ assert.deepEqual(copyMachine(['it works'], 3), [ ]); ``` -The `copyMachine` function should utilize the `spread operator` with array `arr` +La función `copyMachine` debe utilizar el `spread operator` (operador de propagación) con el arreglo `arr` ```js assert(__helpers.removeJSComments(code).match(/\.\.\.arr/)); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md index 54ba5bade9..cdf4aa2184 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md @@ -1,6 +1,6 @@ --- id: 587d7b7a367417b2b2512b12 -title: Copy Array Items Using slice() +title: Copia elementos de un arreglo usando slice() challengeType: 1 forumTopicId: 301158 dashedName: copy-array-items-using-slice @@ -8,25 +8,25 @@ dashedName: copy-array-items-using-slice # --description-- -The next method we will cover is `slice()`. Rather than modifying an array, `slice()` copies or *extracts* a given number of elements to a new array, leaving the array it is called upon untouched. `slice()` takes only 2 parameters — the first is the index at which to begin extraction, and the second is the index at which to stop extraction (extraction will occur up to, but not including the element at this index). Consider this: +El siguiente método que cubriremos es `slice()`. En lugar de modificar un arreglo, `slice()` copia o *extrae* un número determinado de elementos a un nuevo arreglo, dejando intacto el arreglo al que se llama. `slice()` toma sólo 2 parámetros: el primero es el índice en el que se inicia la extracción, y el segundo es el índice en el que se detiene la extracción (la extracción se producirá hasta el índice, pero sin incluir el elemento en este índice). Considera esto: ```js let weatherConditions = ['rain', 'snow', 'sleet', 'hail', 'clear']; let todaysWeather = weatherConditions.slice(1, 3); -// todaysWeather equals ['snow', 'sleet']; -// weatherConditions still equals ['rain', 'snow', 'sleet', 'hail', 'clear'] ``` -In effect, we have created a new array by extracting elements from an existing array. +`todaysWeather` tendrá el valor `['snow', 'sleet']`, mientras que `weatherConditions` todavía tendrá `['rain', 'snow', 'sleet', 'hail', 'clear']`. + +En efecto, hemos creado un nuevo arreglo extrayendo elementos de un arreglo existente. # --instructions-- -We have defined a function, `forecast`, that takes an array as an argument. Modify the function using `slice()` to extract information from the argument array and return a new array that contains the elements `'warm'` and `'sunny'`. +Hemos definido una función, `forecast`, que toma un arreglo como argumento. Modifica la función usando `slice()` para extraer información del arreglo de argumentos y devuelve un nuevo arreglo que contenga los elementos `warm` y `sunny`. # --hints-- -`forecast` should return `["warm", "sunny"]` +`forecast` debe devolver `["warm", "sunny"]` ```js assert.deepEqual( @@ -35,7 +35,7 @@ assert.deepEqual( ); ``` -The `forecast` function should utilize the `slice()` method +La función `forecast` debe utilizar el método `slice()` ```js assert(/\.slice\(/.test(code)); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays.md index 67a4cd9325..3f90d32edf 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays.md @@ -1,6 +1,6 @@ --- id: 587d7b7b367417b2b2512b16 -title: Crear arreglos complejos multidimensionales +title: Crea arreglos complejos multidimensionales challengeType: 1 forumTopicId: 301159 dashedName: create-complex-multi-dimensional-arrays @@ -13,43 +13,45 @@ dashedName: create-complex-multi-dimensional-arrays Una de las características más poderosas cuando se piensa en los arreglos como estructuras de datos, es que los arreglos pueden contener, o incluso estar completamente formados por otros arreglos. Hemos visto arreglos que contienen arreglos en desafíos anteriores, pero bastante simples. Sin embargo, los arreglos pueden contener una profundidad infinita de arreglos que pueden contener otros arreglos, cada uno con sus propios niveles arbitrarios de profundidad, y así sucesivamente. De esta manera, un arreglo puede convertirse rápidamente en una estructura de datos muy compleja, conocida como multidimensional, o arreglo anidado. Considera el siguiente ejemplo: ```js -let nestedArray = [ // top, or first level - the outer most array - ['deep'], // an array within an array, 2 levels of depth +let nestedArray = [ + ['deep'], [ - ['deeper'], ['deeper'] // 2 arrays nested 3 levels deep + ['deeper'], ['deeper'] ], [ [ - ['deepest'], ['deepest'] // 2 arrays nested 4 levels deep + ['deepest'], ['deepest'] ], [ [ - ['deepest-est?'] // an array nested 5 levels deep + ['deepest-est?'] ] ] ] ]; ``` -Aunque este ejemplo pueda parecer enrevesado, este nivel de complejidad no es inaudito, ni siquiera inusual, cuando se trata de grandes cantidades de datos. Sin embargo, podemos acceder muy fácilmente a los niveles más profundos de un arreglo tan complejo con la notación de corchetes: +El arreglo `deep` está anidado a 2 niveles de profundidad. El arreglo `deeper` está a 3 niveles de profundidad. Los arreglos `deepest` están anidados a 4 niveles y el arreglo `deepest-est?` a 5. + +Si bien este ejemplo puede parecer complicado, este nivel de complejidad no es desconocido, ni siquiera inusual, cuando se trata de grandes cantidades de datos. Sin embargo, todavía podemos acceder muy fácilmente a los niveles más profundos de un arreglo tan complejo con notación de corchetes: ```js console.log(nestedArray[2][1][0][0][0]); -// logs: deepest-est? ``` -Y ahora que sabemos dónde está ese dato, podemos restablecerlo si lo necesitamos: +Esto registra la cadena `deepest-est?`. Y ahora que sabemos dónde está ese dato, podemos restablecerlo si es necesario: ```js nestedArray[2][1][0][0][0] = 'deeper still'; console.log(nestedArray[2][1][0][0][0]); -// now logs: deeper still ``` +Ahora registra `deeper still`. + # --instructions-- -Hemos definido una variable, `myNestedArray`, como un arreglo. Modifica `myNestedArray`, utilizando cualquier combinación de cadenas, números y booleanos para los elementos de datos, de modo que tenga exactamente cinco niveles de profundidad (recuerda que el arreglo más externo es el nivel 1). En algún lugar del tercer nivel, incluye la cadena `'deep'`, en el cuarto nivel, incluye la cadena `'deeper'`, y en el quinto nivel, incluye la cadena `'deepest'`. +Hemos definido una variable, `myNestedArray`, como un arreglo. Modifica `myNestedArray`, utilizando cualquier combinación de cadenas, números y booleanos para los elementos de datos, de modo que tenga exactamente cinco niveles de profundidad (recuerda que el arreglo más externo es el nivel 1). En algún lugar del tercer nivel, incluye la cadena `deep`, en el cuarto nivel, incluye la cadena `deeper` y en el quinto nivel, incluye la cadena `deepest`. # --hints-- @@ -100,7 +102,7 @@ assert.strictEqual( ); ``` -`myNestedArray` debe contener exactamente una aparición de la cadena `"deep"` en un arreglo anidado a 3 niveles de profundidad +`myNestedArray` debe contener exactamente una aparición de la cadena `deep` en un arreglo anidado a 3 niveles de profundidad ```js assert( @@ -129,7 +131,7 @@ assert( ); ``` -`myNestedArray` debe contener exactamente una aparición de la cadena `"deeper"` en un arreglo anidado a 4 niveles de profundidad +`myNestedArray` debe contener exactamente una aparición de la cadena `deeper` en un arreglo anidado a 4 niveles de profundidad ```js assert( @@ -158,7 +160,7 @@ assert( ); ``` -`myNestedArray` debe contener exactamente una aparición de la cadena `"deepest"` en un arreglo anidado a 5 niveles de profundidad +`myNestedArray` debe contener exactamente una aparición de la cadena `deepest` en un arreglo anidado a 5 niveles de profundidad ```js assert( diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-all-an-arrays-items-using-for-loops.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-all-an-arrays-items-using-for-loops.md index 6674711f21..e9be570a4b 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-all-an-arrays-items-using-for-loops.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-all-an-arrays-items-using-for-loops.md @@ -1,6 +1,6 @@ --- id: 587d7b7b367417b2b2512b15 -title: Iterate Through All an Array's Items Using For Loops +title: Itera a través de todos los elementos de un arreglo utilizando bucles "for" challengeType: 1 forumTopicId: 301161 dashedName: iterate-through-all-an-arrays-items-using-for-loops @@ -8,9 +8,9 @@ dashedName: iterate-through-all-an-arrays-items-using-for-loops # --description-- -Sometimes when working with arrays, it is very handy to be able to iterate through each item to find one or more elements that we might need, or to manipulate an array based on which data items meet a certain set of criteria. JavaScript offers several built in methods that each iterate over arrays in slightly different ways to achieve different results (such as `every()`, `forEach()`, `map()`, etc.), however the technique which is most flexible and offers us the greatest amount of control is a simple `for` loop. +A veces, cuando se trabaja con arreglos, es muy útil poder iterar a través de cada elemento para encontrar uno o más elementos que podamos necesitar, o manipular un arreglo en función de los elementos de datos que cumplen un determinado conjunto de criterios. JavaScript ofrece varios métodos incorporados que iteran sobre arreglos de formas ligeramente diferentes para conseguir distintos resultados (como `every()`, `forEach()`, `map()`, etc.), sin embargo, la técnica que es más flexible y nos ofrece la mayor cantidad de control es un simple bucle `for`. -Consider the following: +Considera lo siguiente: ```js function greaterThanTen(arr) { @@ -24,18 +24,17 @@ function greaterThanTen(arr) { } greaterThanTen([2, 12, 8, 14, 80, 0, 1]); -// returns [12, 14, 80] ``` -Using a `for` loop, this function iterates through and accesses each element of the array, and subjects it to a simple test that we have created. In this way, we have easily and programmatically determined which data items are greater than `10`, and returned a new array containing those items. +Usando un bucle `for`, esta función itera y accede a cada elemento del arreglo, y lo somete a una simple prueba que hemos creado. De esta manera, hemos determinado de forma sencilla y programática qué elementos de datos son mayores que `10`, y hemos devuelto un nuevo arreglo, `[12, 14, 80]`, que contiene esos elementos. # --instructions-- -We have defined a function, `filteredArray`, which takes `arr`, a nested array, and `elem` as arguments, and returns a new array. `elem` represents an element that may or may not be present on one or more of the arrays nested within `arr`. Modify the function, using a `for` loop, to return a filtered version of the passed array such that any array nested within `arr` containing `elem` has been removed. +Hemos definido una función, `filteredArray`, que toma `arr`, un arreglo anidado, y `elem` como argumentos, y devuelve un nuevo arreglo. `elem` representa un elemento que puede o no estar presente en uno o más de los arreglos anidados dentro de `arr`. Modifica la función, usando un bucle `for`, para que devuelva una versión filtrada del arreglo pasado de forma que cualquier arreglo anidado dentro de `arr` que contenga `elem` haya sido eliminado. # --hints-- -`filteredArray([[10, 8, 3], [14, 6, 23], [3, 18, 6]], 18)` should return `[ [10, 8, 3], [14, 6, 23] ]` +`filteredArray([[10, 8, 3], [14, 6, 23], [3, 18, 6]], 18)` debe devolver `[[10, 8, 3], [14, 6, 23]]` ```js assert.deepEqual( @@ -54,7 +53,7 @@ assert.deepEqual( ); ``` -`filteredArray([ ["trumpets", 2], ["flutes", 4], ["saxophones", 2] ], 2)` should return `[ ["flutes", 4] ]` +`filteredArray([["trumpets", 2], ["flutes", 4], ["saxophones", 2]], 2)` debe devolver `[["flutes", 4]]` ```js assert.deepEqual( @@ -70,7 +69,7 @@ assert.deepEqual( ); ``` -`filteredArray([ ["amy", "beth", "sam"], ["dave", "sean", "peter"] ], "peter")` should return `[ ["amy", "beth", "sam"] ]` +`filteredArray([["amy", "beth", "sam"], ["dave", "sean", "peter"]], "peter")` debe devolver `[["amy", "beth", "sam"]]` ```js assert.deepEqual( @@ -85,7 +84,7 @@ assert.deepEqual( ); ``` -`filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3)` should return `[ ]` +`filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3)` debe devolver `[]` ```js assert.deepEqual( @@ -102,7 +101,7 @@ assert.deepEqual( ); ``` -The `filteredArray` function should utilize a `for` loop +La función `filteredArray` debe utilizar un bucle `for` ```js assert.notStrictEqual(filteredArray.toString().search(/for/), -1); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md index 390132b504..ed07bb3604 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md @@ -1,6 +1,6 @@ --- id: 587d7b7d367417b2b2512b1d -title: Iterate Through the Keys of an Object with a for...in Statement +title: Itera a través de las claves de un objeto con una sentencia "for...in" challengeType: 1 forumTopicId: 301162 dashedName: iterate-through-the-keys-of-an-object-with-a-for---in-statement @@ -8,25 +8,23 @@ dashedName: iterate-through-the-keys-of-an-object-with-a-for---in-statement # --description-- -Sometimes you may need to iterate through all the keys within an object. This requires a specific syntax in JavaScript called a for...in statement. For our `users` object, this could look like: +A veces es necesario iterar por todas las claves de un objeto. Esto requiere una sintaxis específica en JavaScript llamada sentencia for...in. Para nuestro objeto `users`, esto podría verse así: ```js for (let user in users) { console.log(user); } - -// logs: -Alan -Jeff -Sarah -Ryan ``` -In this statement, we defined a variable `user`, and as you can see, this variable was reset during each iteration to each of the object's keys as the statement looped through the object, resulting in each user's name being printed to the console. **NOTE:** Objects do not maintain an ordering to stored keys like arrays do; thus a key's position on an object, or the relative order in which it appears, is irrelevant when referencing or accessing that key. +Esto registrará `Alan`, `Jeff`, `Sarah`, y `Ryan`, cada valor en su propia línea. + +En esta sentencia, definimos una variable `user`, y como puedes ver, esta variable se restablece durante cada iteración a cada una de las claves del objeto a medida que la sentencia hace un bucle a través del objeto, dando como resultado que el nombre de cada usuario se imprima en la consola. + +**NOTA:** Los objetos no mantienen un orden para las claves almacenadas como lo hacen los arreglos; por lo tanto, la posición de una clave en un objeto, o el orden relativo en el que aparece, es irrelevante cuando se hace referencia o se accede a esa clave. # --instructions-- -We've defined a function `countOnline` which accepts one argument (a users object). Use a for...in statement within this function to loop through the users object passed into the function and return the number of users whose `online` property is set to `true`. An example of a users object which could be passed to `countOnline` is shown below. Each user will have an `online` property with either a `true` or `false` value. +Hemos definido una función `countOnline` que acepta un argumento (un objeto usuario). Utiliza una sentencia for...in dentro de esta función para iterar sobre el objeto usuarios (users) pasado a la función y devuelve el número de usuarios cuya propiedad `online` esté establecida como `true`. A continuación se muestra un ejemplo de un objeto usuario que podría pasarse a `countOnline`. Cada usuario tendrá una propiedad `online` con un valor `true` o `false`. ```js { @@ -44,7 +42,7 @@ We've defined a function `countOnline` which accepts one argument (a users objec # --hints-- -The function `countOnline` should use a `for in` statement to iterate through the object keys of the object passed to it. +La función `countOnline` debe utilizar una sentencia `for in` para iterar por las claves del objeto que se le pasa. ```js assert( @@ -54,19 +52,19 @@ assert( ); ``` -The function `countOnline` should return `1` when the object `{ Alan: { online: false }, Jeff: { online: true }, Sarah: { online: false } }` is passed to it +La función `countOnline` debe devolver `1` cuando se le pasa el objeto `{ Alan: { online: false }, Jeff: { online: true }, Sarah: { online: false } }` ```js assert(countOnline(usersObj1) === 1); ``` -The function `countOnline` should return `2` when the object `{ Alan: { online: true }, Jeff: { online: false }, Sarah: { online: true } }` is passed to it +La función `countOnline` debe devolver `2` cuando se le pasa el objeto `{ Alan: { online: true }, Jeff: { online: false }, Sarah: { online: true } }` ```js assert(countOnline(usersObj2) === 2); ``` -The function `countOnline` should return `0` when the object `{ Alan: { online: false }, Jeff: { online: false }, Sarah: { online: false } }` is passed to it +La función `countOnline` debe devolver `0` cuando se le pasa el objeto `{ Alan: { online: false }, Jeff: { online: false }, Sarah: { online: false } }` ```js assert(countOnline(usersObj3) === 0); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-from-an-array-with-pop-and-shift.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-from-an-array-with-pop-and-shift.md index 9cb6b79038..b7976cc351 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-from-an-array-with-pop-and-shift.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-from-an-array-with-pop-and-shift.md @@ -1,6 +1,6 @@ --- id: 587d78b2367417b2b2512b0f -title: Remove Items from an Array with pop() and shift() +title: Elimina elementos de un arreglo con pop() y shift() challengeType: 1 forumTopicId: 301165 dashedName: remove-items-from-an-array-with-pop-and-shift @@ -8,35 +8,39 @@ dashedName: remove-items-from-an-array-with-pop-and-shift # --description-- -Both `push()` and `unshift()` have corresponding methods that are nearly functional opposites: `pop()` and `shift()`. As you may have guessed by now, instead of adding, `pop()` *removes* an element from the end of an array, while `shift()` removes an element from the beginning. The key difference between `pop()` and `shift()` and their cousins `push()` and `unshift()`, is that neither method takes parameters, and each only allows an array to be modified by a single element at a time. +Tanto `push()` como `unshift()` tienen métodos correspondientes que son casi opuestos funcionales: `pop()` y `shift()`. Como ya habrás adivinado, en lugar de agregar, `pop()` *elimina* un elemento al final de un arreglo, mientras que `shift()` elimina un elemento al principio. La diferencia clave entre `pop()` y `shift()` y sus primos `push()` y `unshift()`, es que ninguno de los dos métodos toma parámetros, y cada uno sólo permite modificar un arreglo por un solo elemento a la vez. -Let's take a look: +Echemos un vistazo: ```js let greetings = ['whats up?', 'hello', 'see ya!']; greetings.pop(); -// now equals ['whats up?', 'hello'] - -greetings.shift(); -// now equals ['hello'] ``` -We can also return the value of the removed element with either method like this: +`greetings` tendrá el valor `['whats up?', 'hello']`. + +```js +greetings.shift(); +``` + +`greetings` tendrá el valor `['hello']`. + +También podemos devolver el valor del elemento eliminado con cualquiera de los dos métodos así: ```js let popped = greetings.pop(); -// returns 'hello' -// greetings now equals [] ``` +`greetings` tendrá el valor `[]` y `popped` tendría el valor `hello`. + # --instructions-- -We have defined a function, `popShift`, which takes an array as an argument and returns a new array. Modify the function, using `pop()` and `shift()`, to remove the first and last elements of the argument array, and assign the removed elements to their corresponding variables, so that the returned array contains their values. +Hemos definido una función, `popShift`, el cual toma un arreglo como argumento y devuelve un nuevo arreglo. Modifica la función, usando `pop()` y `shift()`, para eliminar el primer y el último elemento del arreglo, y asignar los elementos eliminados a sus correspondientes variables, de modo que el arreglo que se devuelva contenga sus valores. # --hints-- -`popShift(["challenge", "is", "not", "complete"])` should return `["challenge", "complete"]` +`popShift(["challenge", "is", "not", "complete"])` debe devolver `["challenge", "complete"]` ```js assert.deepEqual(popShift(['challenge', 'is', 'not', 'complete']), [ @@ -45,13 +49,13 @@ assert.deepEqual(popShift(['challenge', 'is', 'not', 'complete']), [ ]); ``` -The `popShift` function should utilize the `pop()` method +La función `popShift` debe utilizar el método `pop()` ```js assert.notStrictEqual(popShift.toString().search(/\.pop\(/), -1); ``` -The `popShift` function should utilize the `shift()` method +La función `popShift` debe utilizar el método `shift()` ```js assert.notStrictEqual(popShift.toString().search(/\.shift\(/), -1); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md index ce579da8e7..fe1f9c285e 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md @@ -1,6 +1,6 @@ --- id: 587d78b2367417b2b2512b10 -title: Remove Items Using splice() +title: Elimina elementos usando splice() challengeType: 1 forumTopicId: 301166 dashedName: remove-items-using-splice @@ -8,34 +8,35 @@ dashedName: remove-items-using-splice # --description-- -Ok, so we've learned how to remove elements from the beginning and end of arrays using `shift()` and `pop()`, but what if we want to remove an element from somewhere in the middle? Or remove more than one element at once? Well, that's where `splice()` comes in. `splice()` allows us to do just that: **remove any number of consecutive elements** from anywhere in an array. +Bien, ya hemos aprendido a eliminar elementos al principio y al final de los arreglos utilizando `shift()` y `pop()`, pero ¿qué pasa si queremos eliminar un elemento de alguna parte del medio? ¿O eliminar más de un elemento a la vez? Pues bien, ahí es donde entra `splice()`. `splice()` nos permite hacer precisamente eso: **eliminar cualquier número de elementos consecutivos** de cualquier parte de un arreglo. -`splice()` can take up to 3 parameters, but for now, we'll focus on just the first 2. The first two parameters of `splice()` are integers which represent indexes, or positions, of the array that `splice()` is being called upon. And remember, arrays are *zero-indexed*, so to indicate the first element of an array, we would use `0`. `splice()`'s first parameter represents the index on the array from which to begin removing elements, while the second parameter indicates the number of elements to delete. For example: +`splice()` puede tomar hasta 3 parámetros, pero por ahora, nos centraremos sólo en los 2 primeros. Los dos primeros parámetros de `splice()` son enteros que representan índices, o posiciones, del arreglo que llama `splice()`. Y recuerda que los arreglos están *indexados en cero*, por lo que para indicar el primer elemento de un arreglo, usaríamos `0`. El primer parámetro de `splice()` representa el índice del arreglo a partir del cual se empiezan a eliminar los elementos, mientras que el segundo parámetro indica el número de elementos a eliminar. Por ejemplo: ```js let array = ['today', 'was', 'not', 'so', 'great']; array.splice(2, 2); -// remove 2 elements beginning with the 3rd element -// array now equals ['today', 'was', 'great'] ``` -`splice()` not only modifies the array it's being called on, but it also returns a new array containing the value of the removed elements: +Aquí eliminamos 2 elementos, comenzando con el tercer elemento (en el índice 2). `array` tendrá el valor `['today', 'was', 'great']`. + +`splice()` no sólo modifica el arreglo que llama, sino que también devuelve un nuevo arreglo que contiene el valor de los elementos eliminados: ```js let array = ['I', 'am', 'feeling', 'really', 'happy']; let newArray = array.splice(3, 2); -// newArray equals ['really', 'happy'] ``` +`newArray` tiene el valor `['really', 'happy']`. + # --instructions-- -We've initialized an array `arr`. Use `splice()` to remove elements from `arr`, so that it only contains elements that sum to the value of `10`. +Hemos inicializado un arreglo `arr`. Usa `splice()` para eliminar elementos de `arr`, de forma que sólo contenga elementos que sumen el valor de `10`. # --hints-- -You should not change the original line of `const arr = [2, 4, 5, 1, 7, 5, 2, 1];`. +No debes cambiar la línea original de `const arr = [2, 4, 5, 1, 7, 5, 2, 1];`. ```js assert( @@ -43,7 +44,7 @@ assert( ); ``` -`arr` should only contain elements that sum to `10`. +`arr` sólo debe contener elementos que sumen `10`. ```js assert.strictEqual( @@ -52,13 +53,13 @@ assert.strictEqual( ); ``` -Your code should utilize the `splice()` method on `arr`. +Tu código debe utilizar el método `splice()` en `arr`. ```js assert(__helpers.removeWhiteSpace(code).match(/arr\.splice\(/)); ``` -The splice should only remove elements from `arr` and not add any additional elements to `arr`. +La división (splice) sólo debe eliminar elementos de `arr` y no agregar ningún elemento adicional a `arr`. ```js assert( diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/use-an-array-to-store-a-collection-of-data.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/use-an-array-to-store-a-collection-of-data.md index 61f8b4f1c3..2e2cff1fdd 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/use-an-array-to-store-a-collection-of-data.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/use-an-array-to-store-a-collection-of-data.md @@ -1,6 +1,6 @@ --- id: 587d7b7e367417b2b2512b20 -title: Use an Array to Store a Collection of Data +title: Utiliza un arreglo para almacenar una colección de datos challengeType: 1 forumTopicId: 301167 dashedName: use-an-array-to-store-a-collection-of-data @@ -8,15 +8,16 @@ dashedName: use-an-array-to-store-a-collection-of-data # --description-- -The below is an example of the simplest implementation of an array data structure. This is known as a one-dimensional array, meaning it only has one level, or that it does not have any other arrays nested within it. Notice it contains booleans, strings, and numbers, among other valid JavaScript data types: +Lo siguiente es un ejemplo de la implementación más simple de una estructura de datos de un arreglo. Esto se conoce como un arreglo unidimensional, lo que significa que sólo tiene un nivel, o que no tiene otros arreglos anidados dentro de él. Observa que contiene booleanos, cadenas y números, entre otros tipos de datos válidos de JavaScript: ```js let simpleArray = ['one', 2, 'three', true, false, undefined, null]; console.log(simpleArray.length); -// logs 7 ``` -All arrays have a length property, which as shown above, can be very easily accessed with the syntax `Array.length`. A more complex implementation of an array can be seen below. This is known as a multi-dimensional array, or an array that contains other arrays. Notice that this array also contains JavaScript objects, which we will examine very closely in our next section, but for now, all you need to know is that arrays are also capable of storing complex objects. +La llamada `console.log` muestra `7`. + +Todos los arreglos tienen una propiedad de longitud, que como se muestra arriba, se puede acceder muy fácilmente con la sintaxis `Array.length`. A continuación se puede ver una implementación más compleja de un arreglo. Esto se conoce como un arreglo multidimensional, o un arreglo que contiene otros arreglos. Observa que este arreglo también contiene objetos JavaScript, que examinaremos muy de cerca en la siguiente sección, pero por ahora, todo lo que necesitas saber es que los arreglos también son capaces de almacenar objetos complejos. ```js let complexArray = [ @@ -45,35 +46,35 @@ let complexArray = [ # --instructions-- -We have defined a variable called `yourArray`. Complete the statement by assigning an array of at least 5 elements in length to the `yourArray` variable. Your array should contain at least one string, one number, and one boolean. +Hemos definido una variable llamada `yourArray`. Completa la sentencia asignando un arreglo de al menos 5 elementos de longitud a la variable `yourArray`. Tu arreglo debe contener al menos una cadena (string), un número (number) y un booleano (boolean). # --hints-- -`yourArray` should be an array. +`yourArray` debe ser un arreglo. ```js assert.strictEqual(Array.isArray(yourArray), true); ``` -`yourArray` should be at least 5 elements long. +`yourArray` debe tener al menos 5 elementos de largo. ```js assert.isAtLeast(yourArray.length, 5); ``` -`yourArray` should contain at least one `boolean`. +`yourArray` debe contener al menos un `boolean`. ```js assert(yourArray.filter((el) => typeof el === 'boolean').length >= 1); ``` -`yourArray` should contain at least one `number`. +`yourArray` debe contener al menos un `number`. ```js assert(yourArray.filter((el) => typeof el === 'number').length >= 1); ``` -`yourArray` should contain at least one `string`. +`yourArray` debe contener al menos un `string`. ```js assert(yourArray.filter((el) => typeof el === 'string').length >= 1); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md index 112933c7b5..d56bf45c7b 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md @@ -14,7 +14,7 @@ Las comillas no son los únicos caracteres que pueden ser escapados d 1. Para permitir el uso de caracteres que de otra manera no te sería posible escribir, como un retorno de carro. 2. Para permitirte representar múltiples comillas en una cadena sin que JavaScript malinterprete lo que quieres decir. -Esto lo aprendimos en el anterior desafío. +Esto lo aprendimos en el desafío anterior.
CódigoResultado
\'comilla simple
\"comilla doble
\\barra invertida
\nlínea nueva
\rretorno de carro
\ttabulación
\blímite de palabra
\ffuente de formulario
diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.md index 39d4b3c002..006acbb9da 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.md @@ -1,6 +1,6 @@ --- id: 56bbb991ad1ed5201cd392ce -title: Manipulate Arrays With unshift() +title: Manipula arreglos con unshift() challengeType: 1 videoUrl: 'https://scrimba.com/c/ckNDESv' forumTopicId: 18239 @@ -9,26 +9,27 @@ dashedName: manipulate-arrays-with-unshift # --description-- -Not only can you `shift` elements off of the beginning of an array, you can also `unshift` elements to the beginning of an array i.e. add elements in front of the array. +No solo puedes desplazar (`shift`) elementos del comienzo de un arreglo, también puedes des-desplazar (`unshift`) elementos al comienzo de un arreglo. Por ejemplo añadir elementos delante del arreglo. -`.unshift()` works exactly like `.push()`, but instead of adding the element at the end of the array, `unshift()` adds the element at the beginning of the array. +`.unshift()` funciona exactamente como `.push()`, pero en lugar de añadir el elemento al final del arreglo, `unshift()` añade el elemento al principio del arreglo. -Example: +Ejemplo: ```js var ourArray = ["Stimpson", "J", "cat"]; -ourArray.shift(); // ourArray now equals ["J", "cat"] +ourArray.shift(); ourArray.unshift("Happy"); -// ourArray now equals ["Happy", "J", "cat"] ``` +Después del `shift`, `ourArray` tendrá el valor `["J", "cat"]`. Después del `unshift`, `ourArray` tendrá el valor `["Happy", "J", "cat"]`. + # --instructions-- -Add `["Paul",35]` to the beginning of the `myArray` variable using `unshift()`. +Añade `["Paul",35]` al principio de la variable `myArray` usando `unshift()`. # --hints-- -`myArray` should now have \[["Paul", 35], ["dog", 3]]. +`myArray` debe contener ahora `[["Paul", 35], ["dog", 3]]`. ```js assert( diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md index c3cb035c38..02eb073a9b 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244b4 -title: Cita cadenas con las comillas simples +title: Cita cadenas con comillas simples challengeType: 1 videoUrl: 'https://scrimba.com/c/cbQmnhM' forumTopicId: 18260 @@ -22,16 +22,18 @@ La razón por la que puedes querer usar un tipo de comilla sobre otro es si quie conversation = 'Finn exclaims to Jake, "Algebraic!"'; ``` -Sin embargo, esto se convierte en un problema cuando es necesario utilizar las comillas externas dentro de ella. Recuerda, una cadena tiene el mismo tipo de comillas al principio y al final. Pero si tienes esa misma comilla en algún lugar del medio, la cadena se detendrá temprano y arrojará un error. +Sin embargo, esto se convierte en un problema cuando es necesario utilizar las comillas externas dentro de ella. Recuerda, una cadena tiene el mismo tipo de comillas al principio y al final. Pero si tienes esa misma comilla en algún lugar del medio, la cadena se detendrá antes de tiempo y arrojará un error. ```js goodStr = 'Jake asks Finn, "Hey, let\'s go on an adventure?"'; -badStr = 'Finn responds, "Let's go!"'; // Throws an error +badStr = 'Finn responds, "Let's go!"'; ``` -En la cadena goodStr anterior, puedes usar ambas comillas de forma segura usando la barra invertida \\ como un carácter de escape. +Aquí `badStr` arrojará un error. -**Nota:** La barra invertida \\ no debe confundirse con la barra diagonal `/`. No hacen lo mismo. +En la cadena goodStr anterior, puedes usar ambas comillas de forma segura usando la barra invertida `\` como un carácter de escape. + +**Nota:** La barra invertida `\` no debe confundirse con la barra diagonal `/`. No hacen lo mismo. # --instructions-- @@ -41,7 +43,7 @@ Ahora mismo, la etiqueta `
` en la cadena usa comillas dobles en todas partes. # --hints-- -Deberías eliminar todas las barras invertidas `backslashes` (\\). +Debes eliminar todas las barras invertidas (`\`). ```js assert( diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.md index b51c7ebdb8..71b650257a 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244c4 -title: Return Early Pattern for Functions +title: Patrón de devolución anticipado para funciones challengeType: 1 videoUrl: 'https://scrimba.com/c/cQe39Sq' forumTopicId: 18272 @@ -9,9 +9,9 @@ dashedName: return-early-pattern-for-functions # --description-- -When a `return` statement is reached, the execution of the current function stops and control returns to the calling location. +Cuando se alcanza una sentencia `return`, la ejecución de la función actual se detiene y el control se devuelve a la ubicación de la llamada. -**Example** +**Ejemplo** ```js function myFun() { @@ -22,54 +22,54 @@ function myFun() { myFun(); ``` -The above outputs "Hello" to the console, returns "World", but `"byebye"` is never output, because the function exits at the `return` statement. +Lo anterior mostrará la cadena `Hello` en la consola y devolverá la cadena `World`. La cadena `byebye` nunca se mostrará en la consola, porque la función termina en la sentencia `return`. # --instructions-- -Modify the function `abTest` so that if `a` or `b` are less than `0` the function will immediately exit with a value of `undefined`. +Modifica la función `abTest` para que cuando `a` o `b` sean menores que `0` la función salga inmediatamente con un valor `undefined`. -**Hint** -Remember that [`undefined` is a keyword](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables), not a string. +**Sugerencia** +Recuerda que [`undefined` es una palabra clave](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables), no una cadena. # --hints-- -`abTest(2,2)` should return a number +`abTest(2,2)` debe devolver un número ```js assert(typeof abTest(2, 2) === 'number'); ``` -`abTest(2,2)` should return `8` +`abTest(2,2)` debe devolver `8` ```js assert(abTest(2, 2) === 8); ``` -`abTest(-2,2)` should return `undefined` +`abTest(-2,2)` debe devolver `undefined` ```js assert(abTest(-2, 2) === undefined); ``` -`abTest(2,-2)` should return `undefined` +`abTest(2,-2)` debe devolver `undefined` ```js assert(abTest(2, -2) === undefined); ``` -`abTest(2,8)` should return `18` +`abTest(2,8)` debe devolver `18` ```js assert(abTest(2, 8) === 18); ``` -`abTest(3,3)` should return `12` +`abTest(3,3)` debe devolver `12` ```js assert(abTest(3, 3) === 12); ``` -`abTest(0,0)` should return `0` +`abTest(0,0)` debe devolver `0` ```js assert(abTest(0, 0) === 0); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md index 1aabc48cbe..bc29770b84 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md @@ -1,6 +1,6 @@ --- id: 5679ceb97cbaa8c51670a16b -title: Returning Boolean Values from Functions +title: Devuelve valores booleanos desde funciones challengeType: 1 videoUrl: 'https://scrimba.com/c/cp62qAQ' forumTopicId: 18273 @@ -9,9 +9,9 @@ dashedName: returning-boolean-values-from-functions # --description-- -You may recall from [Comparison with the Equality Operator](/learn/javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator) that all comparison operators return a boolean `true` or `false` value. +Podrás recordar que en [Comparación con el operador de igualdad](/learn/javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator) todos los operadores de comparación devuelven un valor booleano `true`, o `false`. -Sometimes people use an if/else statement to do a comparison, like this: +A veces la gente usa una sentencia `if/else` para hacer una comparación, como esta: ```js function isEqual(a,b) { @@ -23,7 +23,7 @@ function isEqual(a,b) { } ``` -But there's a better way to do this. Since `===` returns `true` or `false`, we can return the result of the comparison: +Pero hay una mejor manera de hacer esto. Puesto que `===` devuelve `true` o `false`, podemos devolver el resultado de la comparación: ```js function isEqual(a,b) { @@ -33,23 +33,23 @@ function isEqual(a,b) { # --instructions-- -Fix the function `isLess` to remove the `if/else` statements. +Corrige la función `isLess` para eliminar las sentencias `if/else`. # --hints-- -`isLess(10,15)` should return `true` +`isLess(10,15)` debe devolver `true` ```js assert(isLess(10, 15) === true); ``` -`isLess(15,10)` should return `false` +`isLess(15,10)` debe devolver `false` ```js assert(isLess(15, 10) === false); ``` -You should not use any `if` or `else` statements +No debes utilizar las sentencias `if` o `else` ```js assert(!/if|else/g.test(code)); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md index 37ab2df30c..6eae3b7f02 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md @@ -1,6 +1,6 @@ --- id: 56533eb9ac21ba0edf2244bb -title: Word Blanks +title: Palabra en blanco challengeType: 1 videoUrl: 'https://scrimba.com/c/caqn8zuP' forumTopicId: 18377 @@ -9,11 +9,11 @@ dashedName: word-blanks # --description-- -We will now use our knowledge of strings to build a "[Mad Libs](https://en.wikipedia.org/wiki/Mad_Libs)" style word game we're calling "Word Blanks". You will create an (optionally humorous) "Fill in the Blanks" style sentence. +Ahora usaremos nuestros conocimientos de cadenas para construir un juego de palabras estilo "[Mad Libs](https://en.wikipedia.org/wiki/Mad_Libs)" que llamamos "Palabra en blanco". Crearás una frase (opcionalmente humorística) del estilo: Rellena los espacios vacíos. -In a "Mad Libs" game, you are provided sentences with some missing words, like nouns, verbs, adjectives and adverbs. You then fill in the missing pieces with words of your choice in a way that the completed sentence makes sense. +En un juego de "Mad Libs", se te proporcionan oraciones con algunas palabras faltantes, como sustantivos, verbos, adjetivos y adverbios. Luego, rellenas las piezas que faltan con palabras de tu elección de una manera que la frase completa tenga sentido. -Consider this sentence - "It was really **\_\_\_\_**, and we **\_\_\_\_** ourselves **\_\_\_\_**". This sentence has three missing pieces- an adjective, a verb and an adverb, and we can add words of our choice to complete it. We can then assign the completed sentence to a variable as follows: +Considera esta oración: It was really **\_\_\_\_**, and we **\_\_\_\_** ourselves **\_\_\_\_**. Esta oración tiene tres piezas faltantes: un adjetivo, un verbo y un adverbio, y podemos añadir palabras de nuestra elección para completarla. A continuación, podemos asignar la oración completa a una variable de la siguiente manera: ```js var sentence = "It was really " + "hot" + ", and we " + "laughed" + " ourselves " + "silly" + "."; @@ -21,21 +21,21 @@ var sentence = "It was really " + "hot" + ", and we " + "laughed" + " ourselves # --instructions-- -In this challenge, we provide you with a noun, a verb, an adjective and an adverb. You need to form a complete sentence using words of your choice, along with the words we provide. +En este desafío, te proporcionamos un sustantivo, un verbo, un adjetivo y un adverbio. Necesita formar una oración completa usando palabras de tu elección, junto con las palabras que te proporcionamos. -You will need to use the string concatenation operator `+` to build a new string, using the provided variables: `myNoun`, `myAdjective`, `myVerb`, and `myAdverb`. You will then assign the formed string to the `wordBlanks` variable. You should not change the words assigned to the variables. +Necesitarás usar el operador de concatenación de cadenas `+` para construir una nueva cadena, usando las variables proporcionadas: `myNoun`, `myAdjective`, `myVerb`, y `myAdverb`. Luego asignarás la cadena formada a la variable `wordBlanks`. No debes cambiar las palabras asignadas a las variables. -You will also need to account for spaces in your string, so that the final sentence has spaces between all the words. The result should be a complete sentence. +También tendrás que tener en cuenta los espacios en tu cadena, para que la frase final tenga espacios entre todas las palabras. El resultado debe ser una oración completa. # --hints-- -`wordBlanks` should be a string. +`wordBlanks` debe ser una cadena. ```js assert(typeof wordBlanks === 'string'); ``` -You should not change the values assigned to `myNoun`, `myVerb`, `myAdjective` or `myAdverb`. +No debes cambiar los valores asignados a `myNoun`, `myVerb`, `myAdjective` o `myAdverb`. ```js assert( @@ -46,7 +46,7 @@ assert( ); ``` -You should not directly use the values "dog", "ran", "big", or "quickly" to create `wordBlanks`. +No debes utilizar directamente los valores `dog`, `ran`, `big` o `quickly` para crear `wordBlanks`. ```js const newCode = removeAssignments(code); @@ -58,7 +58,7 @@ assert( ); ``` -`wordBlanks` should contain all of the words assigned to the variables `myNoun`, `myVerb`, `myAdjective` and `myAdverb` separated by non-word characters (and any additional words in your madlib). +`wordBlanks` debe contener todas las palabras asignadas a las variables `myNoun`, `myVerb`, `myAdjective` y `myAdverb` separados por espacios (y cualquier palabra adicional en tu madlib). ```js assert( diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md index aac6731f1a..5ca7eb7330 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md @@ -16,10 +16,12 @@ Las variables del siguiente ejemplo son diferentes: function myFunction() { return "You rock!"; } -let varOne = myFunction; // set to equal a function -let varTwo = myFunction(); // set to equal the string "You rock!" +let varOne = myFunction; +let varTwo = myFunction(); ``` +Aquí `varOne` es la función `myFunction`, y `varTwo` es la cadena `You rock!`. + # --instructions-- Corrige el código para que la variable `result` se establezca en el valor devuelto al llamar a la función `getNine`. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md index cdadad8534..f877b9259d 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md @@ -1,6 +1,6 @@ --- id: 587d7b84367417b2b2512b35 -title: Catch Misspelled Variable and Function Names +title: Captura nombres de variables y funciones mal escritos challengeType: 1 forumTopicId: 301186 dashedName: catch-misspelled-variable-and-function-names @@ -8,41 +8,41 @@ dashedName: catch-misspelled-variable-and-function-names # --description-- -The `console.log()` and `typeof` methods are the two primary ways to check intermediate values and types of program output. Now it's time to get into the common forms that bugs take. One syntax-level issue that fast typers can commiserate with is the humble spelling error. +Los métodos `console.log()` y `typeof` son las dos formas principales de comprobar los valores intermedios y los tipos de salida de un programa. Ahora es el momento de entrar en las formas comúnes que adoptan los errores (bugs). Un problema a nivel de sintaxis con el que las personas que escriben rápido pueden simpatizar es el humilde error ortográfico. -Transposed, missing, or mis-capitalized characters in a variable or function name will have the browser looking for an object that doesn't exist - and complain in the form of a reference error. JavaScript variable and function names are case-sensitive. +Los caracteres transpuestos, omitidos o mal escritos en el nombre de una variable o función harán que el navegador busque un objeto que no existe, y se queje en forma de error de referencia. Los nombres de variables y funciones de JavaScript distinguen entre mayúsculas y minúsculas. # --instructions-- -Fix the two spelling errors in the code so the `netWorkingCapital` calculation works. +Corrige los dos errores ortográficos en el código para que funcione el cálculo de `netWorkingCapital`. # --hints-- -Check the spelling of the two variables used in the netWorkingCapital calculation, the console output should show that "Net working capital is: 2". +Comprueba la ortografía de las dos variables utilizadas en el cálculo de netWorkingCapital, la salida de la consola debe mostrar que "Net working capital is: 2". ```js assert(netWorkingCapital === 2); ``` -There should be no instances of mis-spelled variables in the code. +No debe haber casos de variables mal escritas en el código. ```js assert(!code.match(/recievables/g)); ``` -The `receivables` variable should be declared and used properly in the code. +La variable `receivables` debe ser declarada y utilizada correctamente en el código. ```js assert(code.match(/receivables/g).length == 2); ``` -There should be no instances of mis-spelled variables in the code. +No debe haber casos de variables mal escritas en el código. ```js assert(!code.match(/payable;/g)); ``` -The `payables` variable should be declared and used properly in the code. +La variable `payables` debe ser declarada y utilizada correctamente en el código. ```js assert(code.match(/payables/g).length == 2); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md index 319a930402..2faab47cf7 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md @@ -15,17 +15,16 @@ Tener dos opciones es genial cuando una cadena tiene contracciones u otro fragme Aquí hay algunos ejemplos de comillas mezcladas: ```js -// These are correct: const grouchoContraction = "I've had a perfectly wonderful evening, but this wasn't it."; const quoteInString = "Groucho Marx once said 'Quote me as saying I was mis-quoted.'"; -// This is incorrect: const uhOhGroucho = 'I've had a perfectly wonderful evening, but this wasn't it.'; ``` -Por supuesto, está bien utilizar sólo un estilo de comillas. Puedes realizar un escape de las comillas dentro de la cadena utilizando el caracter de escape de la barra invertida (\\): +Los dos primeros son correctos, pero el tercero es incorrecto. + +Por supuesto, está bien utilizar sólo un estilo de comillas. Puedes escapar las comillas dentro de una cadena usando el carácter de barra diagonal invertida (`\`): ```js -// Correct use of same quotes: const allSameQuotes = 'I\'ve had a perfectly wonderful evening, but this wasn\'t it.'; ``` @@ -35,7 +34,7 @@ Corrige la cadena para que use comillas diferentes para el valor de `href`, o re # --hints-- -Tu código debe corregir las comillas alrededor del valor `href` "#Home" cambiándolas o escapándolas. +Tu código debe corregir las comillas alrededor del valor `href` `#Home` cambiándolas o escapándolas. ```js assert(code.match(//g)); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md index d86487c484..5aa676d888 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md @@ -1,6 +1,6 @@ --- id: 587d7b86367417b2b2512b3b -title: Catch Off By One Errors When Using Indexing +title: Captura los errores por uno al utilizar indexación challengeType: 1 forumTopicId: 301189 dashedName: catch-off-by-one-errors-when-using-indexing @@ -8,52 +8,51 @@ dashedName: catch-off-by-one-errors-when-using-indexing # --description-- -Off by one errors (sometimes called OBOE) crop up when you're trying to target a specific index of a string or array (to slice or access a segment), or when looping over the indices of them. JavaScript indexing starts at zero, not one, which means the last index is always one less than the length of the item. If you try to access an index equal to the length, the program may throw an "index out of range" reference error or print `undefined`. +Los errores por uno o por un paso (en inglés: Off-by-one error -OBOE) aparecen cuando se intenta apuntar a un índice específico de una cadena o arreglo (para cortar o acceder a un segmento), o cuando se hace un bucle sobre los índices de los mismos. La indexación en JavaScript comienza en cero, no en uno, lo que significa que el último índice es siempre uno menos que la longitud del elemento. Si intentas acceder a un índice igual a la longitud, el programa puede lanzar un error de referencia "index out of range" (índice fuera de rango) o imprimir `undefined`. -When you use string or array methods that take index ranges as arguments, it helps to read the documentation and understand if they are inclusive (the item at the given index is part of what's returned) or not. Here are some examples of off by one errors: +Cuando se utilizan métodos de cadenas o arreglos que toman rangos de índices como argumentos, es útil leer la documentación y entender si son inclusivos (el elemento en el índice dado es parte de lo que se devuelve) o no. Estos son algunos ejemplos de errores por un paso: ```js let alphabet = "abcdefghijklmnopqrstuvwxyz"; let len = alphabet.length; for (let i = 0; i <= len; i++) { - // loops one too many times at the end console.log(alphabet[i]); } for (let j = 1; j < len; j++) { - // loops one too few times and misses the first character at index 0 console.log(alphabet[j]); } for (let k = 0; k < len; k++) { - // Goldilocks approves - this is just right console.log(alphabet[k]); } ``` +El primer ejemplo aquí hace un bucle de más, y el segundo hace un bucle de menos (falta el primer índice, 0). El tercer ejemplo es correcto. + # --instructions-- -Fix the two indexing errors in the following function so all the numbers 1 through 5 are printed to the console. +Corrige los dos errores de indexación en la siguiente función para que todos los números del 1 al 5 se impriman en la consola. # --hints-- -Your code should set the initial condition of the loop so it starts at the first index. +Tu código debe establecer la condición inicial del bucle para que comience en el primer índice. ```js assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1); ``` -Your code should fix the initial condition of the loop so that the index starts at 0. +Tu código debe corregir la condición inicial del bucle para que el índice comience en 0. ```js assert(!code.match(/i\s?=\s*?1\s*?;/g)); ``` -Your code should set the terminal condition of the loop so it stops at the last index. +Tu código debe establecer la condición terminal del bucle para que se detenga en el último índice. ```js assert(code.match(/i\s*?<\s*?len\s*?;/g).length == 1); ``` -Your code should fix the terminal condition of the loop so that it stops at 1 before the length. +Tu código debe corregir la condición terminal del bucle para que se detenga en 1 antes de la longitud. ```js assert(!code.match(/i\s*?<=\s*?len;/g)); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md index a55d812d8a..a4f71c11c0 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md @@ -1,6 +1,6 @@ --- id: 587d7b84367417b2b2512b36 -title: 'Catch Unclosed Parentheses, Brackets, Braces and Quotes' +title: 'Captura paréntesis, corchetes, llaves y comillas sin cerrar' challengeType: 1 forumTopicId: 301190 dashedName: catch-unclosed-parentheses-brackets-braces-and-quotes @@ -8,23 +8,23 @@ dashedName: catch-unclosed-parentheses-brackets-braces-and-quotes # --description-- -Another syntax error to be aware of is that all opening parentheses, brackets, curly braces, and quotes have a closing pair. Forgetting a piece tends to happen when you're editing existing code and inserting items with one of the pair types. Also, take care when nesting code blocks into others, such as adding a callback function as an argument to a method. +Otro error de sintaxis a tener en cuenta es que todos los paréntesis de apertura, corchetes, llaves y comillas tienen un par de cierre. Olvidar una pieza suele suceder cuando se edita el código existente y se insertan elementos con uno de los tipos de pares. También hay que tener cuidado al anidar bloques de código dentro de otros, como agregar una función de callback como argumento de un método. -One way to avoid this mistake is as soon as the opening character is typed, immediately include the closing match, then move the cursor back between them and continue coding. Fortunately, most modern code editors generate the second half of the pair automatically. +Una forma de evitar este error es, tan pronto como se escriba el caracter de apertura, incluir inmediatamente su caracter de cierre, luego mover el cursor hacia atrás entre ellos y continuar escribiendo. Afortunadamente, la mayoría de los editores de código modernos generan la segunda mitad del par automáticamente. # --instructions-- -Fix the two pair errors in the code. +Corrige los dos errores de par en el código. # --hints-- -Your code should fix the missing piece of the array. +Tu código debe arreglar la pieza que falta en el arreglo. ```js assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); ``` -Your code should fix the missing piece of the `.reduce()` method. The console output should show that "Sum of array values is: 6". +Tu código debe arreglar la pieza que falta del método `.reduce()`. La salida de la consola debe mostrar `Sum of array values is: 6`. ```js assert(arraySum === 6); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md index b1fafcbd31..8f2780e32d 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md @@ -20,12 +20,14 @@ El código siguiente asigna a `x` el valor de 2, que se evalúa como `true`. Cas let x = 1; let y = 2; if (x = y) { - // this code block will run for any value of y (unless y were originally set as a falsy) + } else { - // this code block is what should run (but won't) in this example + } ``` +En este ejemplo, el bloque de código dentro de la sentencia `if` se ejecutará para cualquier valor de `y`, a menos que `y` sea algún valor falsy. El bloque `else`, que esperamos que se ejecute aquí, no se ejecutará realmente. + # --instructions-- Corrige la condición para que el programa ejecute la rama correcta y se asigne el valor adecuado a `result`. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md index 10f47a1581..784a4ace20 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md @@ -1,6 +1,6 @@ --- id: 587d7b83367417b2b2512b37 -title: Understanding the Differences between the freeCodeCamp and Browser Console +title: Entendiendo las diferencias entre la consola de freeCodeCamp y la del navegador challengeType: 1 forumTopicId: 301193 dashedName: understanding-the-differences-between-the-freecodecamp-and-browser-console @@ -8,27 +8,27 @@ dashedName: understanding-the-differences-between-the-freecodecamp-and-browser-c # --description-- -You may have noticed that some freeCodeCamp JavaScript challenges include their own console. This console behaves a little differently than the browser console you used in the last challenge. +Habrás notado que algunos desafíos de JavaScript de freeCodeCamp incluyen su propia consola. Esta consola se comporta un poco diferente a la consola del navegador que utilizaste en el último desafío. -The following challenge is meant to highlight the main difference between the freeCodeCamp console and your browser console. +El siguiente desafío pretende destacar la principal diferencia entre la consola de freeCodeCamp y la de tu navegador. -When you run ordinary JavaScript, the browser's console will display your `console.log()` statements the exact number of times it is called. +Cuando se ejecuta JavaScript ordinario, la consola del navegador mostrará sus declaraciones `console.log()` el número exacto de veces que se llama. -The freeCodeCamp console will print your `console.log()` statements a short time after the editor detects a change in the script, as well as during testing. +La consola de freeCodeCamp imprimirá sus declaraciones `console.log()` poco después de que el editor detecte un cambio en el script, así como durante las pruebas. -The freeCodeCamp console is cleared before the tests are run and, to avoid spam, only prints the logs during the first test (see the note below for exceptions). +La consola de freeCodeCamp se borra antes de que se ejecuten las pruebas y, para evitar el spam, sólo imprime los registros durante la primera prueba (véase la nota siguiente para las excepciones). -If you would like to see every log for every test, run the tests, and open the browser console. If you prefer to use the browser console, and want it to mimic the freeCodeCamp console, place `console.clear()` before any other `console` calls, to clear the browser console. +Si quieres ver todos los registros de cada prueba, ejecuta las pruebas y abre la consola del navegador. Si prefieres usar la consola del navegador, y quieres que imite la consola de freeCodeCamp, coloca `console.clear()` antes de cualquier otra llamada a `console`, para limpiar la consola del navegador. -**Note:** `console.log`s inside functions are printed to the freeCodeCamp console whenever those functions are called, this can help debugging functions that are called during testing. +**Nota: ** las funciones internas de `console.log` se imprimen en la consola de freeCodeCamp siempre que se llaman. Esto puede ayudar a depurar funciones que se llaman durante la prueba. # --instructions-- -First, use `console.log` to log the `output` variable. Then, use `console.clear` to clear the browser console. +Primero, usa `console.log` para imprimir la variable `output`. Luego, usa `console.clear` para limpiar la consola del navegador. # --hints-- -You should use `console.clear()` to clear the browser console. +Debes utilizar `console.clear()` para limpiar la consola del navegador. ```js assert( @@ -38,7 +38,7 @@ assert( ); ``` -You should use `console.log()` to print the `output` variable. +Debes utilizar `console.log()` para imprimir la variable `output`. ```js assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/)); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md index bfeecb112e..d21a0872fa 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md @@ -14,7 +14,7 @@ Puedes encontrar las herramientas para desarrolladores en el menú de Chrome o l El método `console.log()`, que "imprime" la salida de lo que está dentro de sus paréntesis a la consola, será probablemente la herramienta de depuración más útil. Colocarlo en puntos estratégicos de tu código puede mostrarte los valores intermedios de las variables. Es una buena práctica tener una idea de lo que debería ser la salida antes de ver lo que es. Tener puntos de control para ver el estado de tus cálculos a lo largo de tu código ayudará a acotar dónde está el problema. -Este es un ejemplo para imprimir "Hello world!" en la consola: +Aquí hay un ejemplo para imprimir la cadena `Hello world!` en la consola: `console.log('Hello world!');` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md index b69881e663..5080bc4f94 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md @@ -13,12 +13,14 @@ Puedes utilizar `typeof` para comprobar la estructura de datos, o tipo, de una v Aquí hay algunos ejemplos que utilizan `typeof`: ```js -console.log(typeof ""); // outputs "string" -console.log(typeof 0); // outputs "number" -console.log(typeof []); // outputs "object" -console.log(typeof {}); // outputs "object" +console.log(typeof ""); +console.log(typeof 0); +console.log(typeof []); +console.log(typeof {}); ``` +En orden, la consola mostrará las cadenas `string`, `number`, `object`, y `object`. + JavaScript reconoce seis tipos de datos primitivos (inmutables): `Boolean`, `Null`, `Undefined`, `Number`, `String`, y `Symbol` (nuevo con ES6) y un tipo para elementos mutables: `Object`. Ten en cuenta que en JavaScript, los arreglos son técnicamente un tipo de objeto. # --instructions--