diff --git a/exercises/065-or/README.es.md b/exercises/065-or/README.es.md index 4fb5459a2..11aac312f 100644 --- a/exercises/065-or/README.es.md +++ b/exercises/065-or/README.es.md @@ -1,8 +1,10 @@ # `065` or +En este ejercicio vamos a replicar el comportamiento del operador l贸gico OR `||` sin usar el propio operador. 驴Recuerdas c贸mo funciona? + ## 馃摑 Instrucciones: -1. Escribe una funci贸n llamada `or`. Dadas 2 expresiones booleanas, `or` retorna true o false, correspondiente al operador `||`. +1. Escribe una funci贸n llamada `or`. Dadas 2 expresiones booleanas, `or` retorna true o false, siguiendo las reglas del operador `||`. ## 馃搸 Ejemplo: diff --git a/exercises/065-or/README.md b/exercises/065-or/README.md index ce058587a..b65b76c81 100644 --- a/exercises/065-or/README.md +++ b/exercises/065-or/README.md @@ -1,8 +1,10 @@ # `065` or +In this exercise, we are going to replicate the behavior of the logical operator OR `||` without actually using the operator itself. Do you remember how it works? + ## 馃摑 Instructions: -1. Write a function called `or`. Given 2 boolean expressions, `or` returns true or false, corresponding to the `||` operator. +1. Write a function called `or`. Given 2 boolean expressions, `or` returns true or false, following the rules of the `||` operator. ## 馃搸 Example: diff --git a/exercises/107-getLengthOfLongestElement/solution.hide.js b/exercises/107-getLengthOfLongestElement/solution.hide.js index b7146acf0..68747b76a 100644 --- a/exercises/107-getLengthOfLongestElement/solution.hide.js +++ b/exercises/107-getLengthOfLongestElement/solution.hide.js @@ -1,12 +1,14 @@ function getLengthOfLongestElement(arr) { - // Your code here - if (arr.length < 1) return 0 - else { - let aux = 0 - arr.map(item=> item.length > aux ? aux = item.length : null) - return aux; + // your code here + let longestLength = 0; + for (let i = 0; i < arr.length; i++) { + if (arr[i].length > longestLength) { + longestLength = arr[i].length; } + } + + return longestLength; } let output = getLengthOfLongestElement(['one', 'two', 'three']); -console.log(output); // --> 5 \ No newline at end of file +console.log(output); // --> 5 diff --git a/exercises/111-getElementOfArrayProperty/README.es.md b/exercises/111-getElementOfArrayProperty/README.es.md index b1820b1ed..6bcb44156 100644 --- a/exercises/111-getElementOfArrayProperty/README.es.md +++ b/exercises/111-getElementOfArrayProperty/README.es.md @@ -2,7 +2,7 @@ ## 馃摑 Instrucciones: -1. Escribe una funci贸n llamada `getElementOfArrayProperty`. Dados un objeto, una key y un index n煤merico, `getElementOfArrayProperty` retorna el valor de un elemento en el index proporcionado del array ubicado dentro del objeto en la key dada. +1. Escribe una funci贸n llamada `getElementOfArrayProperty`. Dados un objeto, una key y un index num茅rico, `getElementOfArrayProperty` retorna el valor de un elemento en el index proporcionado del array ubicado dentro del objeto en la key dada. ## 馃搸 Ejemplo: diff --git a/exercises/120-getLargestElement/solution.hide.js b/exercises/120-getLargestElement/solution.hide.js index 15e10542c..b23c8d61f 100644 --- a/exercises/120-getLargestElement/solution.hide.js +++ b/exercises/120-getLargestElement/solution.hide.js @@ -2,7 +2,7 @@ function getLargestElement(arr) { // your code here if (arr.length < 1) return 0; - let aux = 0; + let aux = arr[0]; for (let e of arr) { if (aux < e) aux = e; } diff --git a/exercises/120-getLargestElement/test.js b/exercises/120-getLargestElement/test.js index 21c3d7555..289682a60 100644 --- a/exercises/120-getLargestElement/test.js +++ b/exercises/120-getLargestElement/test.js @@ -21,6 +21,10 @@ test('Function must return the largest number within the array. Testing with dif expect(getLargestElement([15, 22, 18, 23])).toBe(23); }); +test('Function must return the largest number within the array. Testing with different values', () => { + expect(getLargestElement([-5, -2, -8, -3])).toBe(-2); +}); + test('If array is empty, it should return 0', () => { let output = getLargestElement([]); expect(output).toBe(0); diff --git a/exercises/121-computeSumOfAllElements/solution.hide.js b/exercises/121-computeSumOfAllElements/solution.hide.js index c60e69b85..8d8ace376 100644 --- a/exercises/121-computeSumOfAllElements/solution.hide.js +++ b/exercises/121-computeSumOfAllElements/solution.hide.js @@ -7,5 +7,5 @@ function computeSumOfAllElements(arr) { return aux; } -var output = computeSumOfAllElements([1, 2, 3]); +let output = computeSumOfAllElements([1, 2, 3]); console.log(output); // --> 6 diff --git a/exercises/124-joinArraysOfArrays/README.es.md b/exercises/124-joinArraysOfArrays/README.es.md index 6bcc43b49..c28cfd224 100644 --- a/exercises/124-joinArraysOfArrays/README.es.md +++ b/exercises/124-joinArraysOfArrays/README.es.md @@ -2,7 +2,7 @@ ## 馃摑 Instrucciones: -1. Escribe una funci贸n llamada `joinArrayOfArrays`. Dado una matriz (array de arrays), `joinArrayOfArrays` retorna un array 煤nico que contenga los elementos de los arrays anidados. +1. Escribe una funci贸n llamada `joinArrayOfArrays`. Dada una matriz (array de arrays), `joinArrayOfArrays` retorna un array 煤nico que contenga los elementos de los arrays anidados. ## 馃搸 Ejemplo: diff --git a/exercises/133-convertScoreToGrade/README.es.md b/exercises/133-convertScoreToGrade/README.es.md index 9d3f6d810..b08c218cd 100644 --- a/exercises/133-convertScoreToGrade/README.es.md +++ b/exercises/133-convertScoreToGrade/README.es.md @@ -13,14 +13,12 @@ console.log(output); // --> 'A' ## 馃挕 Pistas: -+ (100 - 90) --> 'A' - -+ (89 - 80) --> 'B' - -+ (79 - 70) --> 'C' - -+ (69 - 60) --> 'D' - -+ (59 - 0) --> 'F' +| Puntaje | Grado | +|:---------:|:-------:| +| 100 - 90 | 'A' | +| 89 - 80 | 'B' | +| 79 - 70 | 'C' | +| 69 - 60 | 'D' | +| 59 - 0 | 'F' | + Si la puntuaci贸n dada es mayor que 100 o menor que 0, `convertScoreToGrade` deber铆a retornar `INVALID SCORE`. diff --git a/exercises/133-convertScoreToGrade/README.md b/exercises/133-convertScoreToGrade/README.md index e024e315d..b4c2b6350 100644 --- a/exercises/133-convertScoreToGrade/README.md +++ b/exercises/133-convertScoreToGrade/README.md @@ -13,14 +13,12 @@ console.log(output); // --> 'A' ## 馃挕 Hints: -+ (100 - 90) --> 'A' - -+ (89 - 80) --> 'B' - -+ (79 - 70) --> 'C' - -+ (69 - 60) --> 'D' - -+ (59 - 0) --> 'F' +| Score | Grade | +|:---------:|:-------:| +| 100 - 90 | 'A' | +| 89 - 80 | 'B' | +| 79 - 70 | 'C' | +| 69 - 60 | 'D' | +| 59 - 0 | 'F' | + If the given score is greater than 100 or less than 0, `convertScoreToGrade` should return `INVALID SCORE`. diff --git a/exercises/134-convertScoreToGradeWithPlus/README.es.md b/exercises/134-convertScoreToGradeWithPlus/README.es.md index 23c4c81ab..acf1e279d 100644 --- a/exercises/134-convertScoreToGradeWithPlus/README.es.md +++ b/exercises/134-convertScoreToGradeWithPlus/README.es.md @@ -13,15 +13,13 @@ console.log(output); // --> 'A-' ## 馃挕 Pistas: -+ (100 - 90) --> 'A' - -+ (89 - 80) --> 'B' - -+ (79 - 70) --> 'C' - -+ (69 - 60) --> 'D' - -+ (59 - 0) --> 'F' +| Puntaje | Grado | +|:---------:|:-------:| +| 100 - 90 | 'A' | +| 89 - 80 | 'B' | +| 79 - 70 | 'C' | +| 69 - 60 | 'D' | +| 59 - 0 | 'F' | + Si el puntaje dado es mayor que 100 o menor que 0, deber铆a retornar `INVALID SCORE`. diff --git a/exercises/134-convertScoreToGradeWithPlus/README.md b/exercises/134-convertScoreToGradeWithPlus/README.md index 85d9e5e64..5e2f0361a 100644 --- a/exercises/134-convertScoreToGradeWithPlus/README.md +++ b/exercises/134-convertScoreToGradeWithPlus/README.md @@ -13,15 +13,13 @@ console.log(output); // --> 'A-' ## 馃挕 Hints: -+ (100 - 90) --> 'A' - -+ (89 - 80) --> 'B' - -+ (79 - 70) --> 'C' - -+ (69 - 60) --> 'D' - -+ (59 - 0) --> 'F' +| Score | Grade | +|:--------: |:-----: | +| 100 - 90 | 'A' | +| 89 - 80 | 'B' | +| 79 - 70 | 'C' | +| 69 - 60 | 'D' | +| 59 - 0 | 'F' | + If the given score is greater than 100 or less than 0, it should return `INVALID SCORE`. diff --git a/exercises/135-computeFactorialOfN/app.js b/exercises/135-computeFactorialOfN/app.js index fbcdf9af8..355f2cf34 100644 --- a/exercises/135-computeFactorialOfN/app.js +++ b/exercises/135-computeFactorialOfN/app.js @@ -3,5 +3,5 @@ function computeFactorialOfN(n) { } -let output = computeFactorialOfN(3); -console.log(output); // --> 6 +let output = computeFactorialOfN(4); +console.log(output); // --> 24 diff --git a/exercises/135-computeFactorialOfN/solution.hide.js b/exercises/135-computeFactorialOfN/solution.hide.js index 291006b2e..c244b1970 100644 --- a/exercises/135-computeFactorialOfN/solution.hide.js +++ b/exercises/135-computeFactorialOfN/solution.hide.js @@ -5,8 +5,5 @@ function computeFactorialOfN(n) { return aux; } -let output = computeFactorialOfN(3); -console.log(output); // --> 6 - let output = computeFactorialOfN(4); console.log(output); // --> 24 diff --git a/exercises/139-computeCompoundInterest/README.es.md b/exercises/139-computeCompoundInterest/README.es.md index fa965fc57..5ff177854 100644 --- a/exercises/139-computeCompoundInterest/README.es.md +++ b/exercises/139-computeCompoundInterest/README.es.md @@ -13,4 +13,4 @@ console.log(output); // --> 438.83682213410543 ## 馃挕 Pista: -- Aqu铆 puedes ver la f贸rmula utilizada para calcular el inter茅s compuesto total generado: [Calculation_of_compound_interest](https://en.wikipedia.org/wiki/Compound_interest#Calculation_of_compound_interest) +- Aqu铆 puedes ver la f贸rmula utilizada para calcular el inter茅s compuesto total generado: [Calculation_of_compound_interest](https://en.wikipedia.org/wiki/Compound_interest#Calculation) diff --git a/exercises/139-computeCompoundInterest/README.md b/exercises/139-computeCompoundInterest/README.md index 17542271c..bf039c67e 100644 --- a/exercises/139-computeCompoundInterest/README.md +++ b/exercises/139-computeCompoundInterest/README.md @@ -11,6 +11,6 @@ let output = computeCompoundInterest(1500, .043, 4, 6); console.log(output); // --> 438.83682213410543 ``` -## 馃挕 Hints: +## 馃挕 Hint: -- Check the formula used to calculate the total compound insterest generated: [Calculation_of_compound_interest](https://en.wikipedia.org/wiki/Compound_interest#Calculation_of_compound_interest) +- Check the formula used to calculate the total compound insterest generated: [Calculation_of_compound_interest](https://en.wikipedia.org/wiki/Compound_interest#Calculation) diff --git a/exercises/140-modulo/README.es.md b/exercises/140-modulo/README.es.md index ccc5ab912..f3a629089 100644 --- a/exercises/140-modulo/README.es.md +++ b/exercises/140-modulo/README.es.md @@ -13,7 +13,7 @@ console.log(output); // --> 1 ## 馃挕 Pistas: -+ La funci贸n debe comportarse como se describe en la [documentaci贸n can贸nica (MDN) para el operador resto de JavaScript](https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Operators/Remainder) ++ La funci贸n debe comportarse como se describe en la [documentaci贸n can贸nica (MDN) para el operador resto de JavaScript](https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Operators/Remainder). + NO uses el operador de m贸dulo incorporado (tambi茅n conocido como "resto") (`%`) en la implementaci贸n. diff --git a/exercises/140-modulo/solution.hide.js b/exercises/140-modulo/solution.hide.js index f279bfc51..d4ebc12bc 100644 --- a/exercises/140-modulo/solution.hide.js +++ b/exercises/140-modulo/solution.hide.js @@ -1,5 +1,9 @@ function modulo(num1, num2) { // your code here + if (num2 === 0 || isNaN(num1) || isNaN(num2)) { + return NaN; + } + let i = 0; if(num1 > 0) { while (i < num1) { diff --git a/exercises/141-multiply/solution.hide.js b/exercises/141-multiply/solution.hide.js index fd137c5e9..b833c0e3c 100644 --- a/exercises/141-multiply/solution.hide.js +++ b/exercises/141-multiply/solution.hide.js @@ -1,12 +1,28 @@ function multiply(num1, num2) { // your code here - let aux = 0; - if (num1 < 0) { - for (let times = 0; times < num2; times++) aux += num1; - } else { - for (let times = 0; times < num1; times++) aux += num2; + let result = 0; + let isNegative = false; + + // Check if the result will be negative + if ((num1 < 0 && num2 > 0) || (num1 > 0 && num2 < 0)) { + isNegative = true; + } + + // Convert both numbers to positive + num1 = Math.abs(num1); + num2 = Math.abs(num2); + + // Add num1 to result num2 times + for (let i = 0; i < num2; i++) { + result += num1; } - return aux; + + // If the result should be negative, negate it + if (isNegative) { + result = -result; + } + + return result; } let output = multiply(2, -7); diff --git a/exercises/141-multiply/test.js b/exercises/141-multiply/test.js index ffad8a6c6..fb1fadce1 100644 --- a/exercises/141-multiply/test.js +++ b/exercises/141-multiply/test.js @@ -13,14 +13,22 @@ test('Function multiply must return a number', () => { expect(typeof multiply(1, 2)).toBe('number'); }); -test('Given 2 whole numbers, multiply and return the total', () => { +test('Given 2 integer numbers, multiply and return the total', () => { expect(multiply(4, 7)).toBe(28); }); -test('Given 2 whole numbers, multiply and return the total. Testing with negative value', () => { +test('Given 2 integer numbers, multiply and return the total. Testing with different values', () => { expect(multiply(5, -5)).toBe(-25); }); +test('Given 2 integer numbers, multiply and return the total. Testing with different values', () => { + expect(multiply(-5, -3)).toBe(15); +}); + +test('Given 2 integer numbers, multiply and return the total. Testing with different values', () => { + expect(multiply(0, -5)).toBe(0); +}); + test('Must not use the * operator', () => { let multiplyOperator = '*'; expect(multiplyOperator).not.toBe(multiply); diff --git a/exercises/142-isOddWithoutModulo/solution.hide.js b/exercises/142-isOddWithoutModulo/solution.hide.js index d3d1130c3..7f5e83e1f 100644 --- a/exercises/142-isOddWithoutModulo/solution.hide.js +++ b/exercises/142-isOddWithoutModulo/solution.hide.js @@ -1,7 +1,7 @@ function isOddWithoutModulo(num) { // your code here let aux = true; - if(num >= 0){ + if (num >= 0) { for (let x = 0; x <= num + 1; x += 2) { if (x === num) aux = false; } diff --git a/exercises/143-isEvenWithoutModulo/solution.hide.js b/exercises/143-isEvenWithoutModulo/solution.hide.js index dde8c1b12..22f4705ca 100644 --- a/exercises/143-isEvenWithoutModulo/solution.hide.js +++ b/exercises/143-isEvenWithoutModulo/solution.hide.js @@ -13,5 +13,5 @@ function isEvenWithoutModulo(num) { return aux; } -let output = isEvenWithoutModulo(18); -console.log(output); // --> false +let output = isEvenWithoutModulo(8); +console.log(output); // --> true diff --git a/exercises/143-isEvenWithoutModulo/test.js b/exercises/143-isEvenWithoutModulo/test.js index 9928d77c6..fe6e56634 100644 --- a/exercises/143-isEvenWithoutModulo/test.js +++ b/exercises/143-isEvenWithoutModulo/test.js @@ -5,7 +5,7 @@ test('Function isEvenWithoutModulo must exist', () => { expect(isEvenWithoutModulo).not.toBe(undefined); }); -test('Function isEvenWithoutModulo must exist', () => { +test('Function isEvenWithoutModulo must return something', () => { expect(isEvenWithoutModulo(1)).not.toBe(undefined); }); diff --git a/exercises/146.1-ArrayToObject/README.es.md b/exercises/146.1-ArrayToObject/README.es.md index 6c8d05e76..5de903af7 100644 --- a/exercises/146.1-ArrayToObject/README.es.md +++ b/exercises/146.1-ArrayToObject/README.es.md @@ -2,20 +2,20 @@ ## 馃摑 Instrucciones: -1. Escribe una funci贸n `transformFirstAndLast` que tome un array y devuelva un objeto cuyo *primer elemento sea la key del objeto*, y cuyo *煤ltimo elemento sea el valor de esa key*. +1. Escribe una funci贸n `transformFirstAndLast` que tome un array y devuelva un objeto cuyo **primer elemento sea la key del objeto**, y cuyo **煤ltimo elemento sea el valor de esa key**. ## 馃搸 Ejemplo 1: ```js let output = transformFirstAndLast(['Queen', 'Elizabeth', 'Of Hearts', 'Beyonce']) -console.log(output); // { Queen: "Beyonce" } +console.log(output); // --> { Queen: "Beyonce" } ``` ## 馃搸 Ejemplo 2: ```js let output = transformFirstAndLast(['Kevin', 'Bacon', 'Love', 'Hart', 'Costner', 'Spacey']) -console.log(output); // { Kevin: "Spacey" } +console.log(output); // --> { Kevin: "Spacey" } ``` ## 馃挕 Pistas: @@ -24,4 +24,4 @@ console.log(output); // { Kevin: "Spacey" } + Asume que todos los elementos en el array de entrada ser谩n del tipo `string`. -+ Ten en cuenta que el array de entrada puede teneruna cantidad variable de elementos por lo que tu c贸digo debe ser flexible. ++ Ten en cuenta que el array de entrada puede tener una cantidad variable de elementos por lo que tu c贸digo debe ser flexible. diff --git a/exercises/146.1-ArrayToObject/README.md b/exercises/146.1-ArrayToObject/README.md index a5c235faf..cf6d5fb06 100644 --- a/exercises/146.1-ArrayToObject/README.md +++ b/exercises/146.1-ArrayToObject/README.md @@ -2,20 +2,20 @@ ## 馃摑 Instructions: -1. Write a function called `transformFirstAndLast` that takes in an array, and returns an object with *the first element of the array as the object's key*, and *the last element of the array as that key's value*. +1. Write a function called `transformFirstAndLast` that takes in an array, and returns an object with **the first element of the array as the object's key**, and **the last element of the array as that key's value**. ## 馃搸 Example 1: ```js let output = transformFirstAndLast(['Queen', 'Elizabeth', 'Of Hearts', 'Beyonce']) -console.log(output); // { Queen: "Beyonce" } +console.log(output); // --> { Queen: "Beyonce" } ``` ## 馃搸 Example 2: ```js let output = transformFirstAndLast(['Kevin', 'Bacon', 'Love', 'Hart', 'Costner', 'Spacey']) -console.log(output); // { Kevin: "Spacey" } +console.log(output); // --> { Kevin: "Spacey" } ``` ## 馃挕 Hints: diff --git a/exercises/146.2-ArrayToObject/README.es.md b/exercises/146.2-ArrayToObject/README.es.md index f54d154fa..99c1c18ca 100644 --- a/exercises/146.2-ArrayToObject/README.es.md +++ b/exercises/146.2-ArrayToObject/README.es.md @@ -1,8 +1,8 @@ -# `146.2` ArraytoObject +# `146.2` ArrayToObject ## 馃摑 Instrucciones: -1. Escribe una funci贸n `fromListToObject` que tome una matriz (array de arrays), y retorne *un objeto con cada par de elementos de la matriz como un par clave-valor (key-value)*. +1. Escribe una funci贸n `fromListToObject` que tome una matriz (array de arrays), y retorne **un objeto con cada par de elementos de la matriz como un par clave-valor (key-value)**. ## 馃搸 Ejemplo: diff --git a/exercises/146.2-ArrayToObject/README.md b/exercises/146.2-ArrayToObject/README.md index 8bb599859..c88955a9c 100644 --- a/exercises/146.2-ArrayToObject/README.md +++ b/exercises/146.2-ArrayToObject/README.md @@ -1,8 +1,8 @@ -# `146.2` ArraytoObject +# `146.2` ArrayToObject ## 馃摑 Instructions: -1. Write a function `fromListToObject` which takes in a matrix (an array of arrays), and returns an object with *each pair of elements in the array as a key-value pair*. +1. Write a function `fromListToObject` which takes in a matrix (an array of arrays), and returns an object with **each pair of elements in the array as a key-value pair**. ## 馃搸 Example: diff --git a/exercises/146.3-ArrayToObject/README.es.md b/exercises/146.3-ArrayToObject/README.es.md index bbf9e12e2..757718e85 100644 --- a/exercises/146.3-ArrayToObject/README.es.md +++ b/exercises/146.3-ArrayToObject/README.es.md @@ -1,8 +1,8 @@ -# `146.3` ArraytoObject +# `146.3` ArrayToObject ## 馃摑 Instrucciones: -1. Escribe una funci贸n llamada `transformEmployeeData` que transforma algunos datos de los empleados de un formato a otro. +1. Escribe una funci贸n llamada `transformEmployeeData` que transforma datos de empleados de un formato a otro. ## 馃搸 Ejemplo: diff --git a/exercises/146.3-ArrayToObject/README.md b/exercises/146.3-ArrayToObject/README.md index f8be6e8d5..421e4d217 100644 --- a/exercises/146.3-ArrayToObject/README.md +++ b/exercises/146.3-ArrayToObject/README.md @@ -1,8 +1,8 @@ -# `146.3` ArraytoObject +# `146.3` ArrayToObject ## 馃摑 Instructions: -1. Write a function called `transformEmployeeData` that transforms some employee data from one format to another. +1. Write a function called `transformEmployeeData` that transforms employee data from one format to another. ## 馃搸 Example: diff --git a/exercises/147.1-ObjectToArray/solution.hide.js b/exercises/147.1-ObjectToArray/solution.hide.js index 80f82a102..7b61673f6 100644 --- a/exercises/147.1-ObjectToArray/solution.hide.js +++ b/exercises/147.1-ObjectToArray/solution.hide.js @@ -1,7 +1,7 @@ function getAllKeys(obj) { // your code here let arr = []; - for(let element in obj){ + for(let element in obj) { arr.push(element); } return arr diff --git a/exercises/147.2-ObjectToArray/app.js b/exercises/147.2-ObjectToArray/app.js index 83713d787..6bd6e18b0 100644 --- a/exercises/147.2-ObjectToArray/app.js +++ b/exercises/147.2-ObjectToArray/app.js @@ -1,5 +1,6 @@ function listAllValues(obj) { // your code here + } let output = listAllValues({ name: 'Sam', age: 25, hasPets: true }); diff --git a/exercises/147.3-ObjectToArray/app.js b/exercises/147.3-ObjectToArray/app.js index 68a91f456..dab51da1f 100644 --- a/exercises/147.3-ObjectToArray/app.js +++ b/exercises/147.3-ObjectToArray/app.js @@ -1,5 +1,6 @@ function convertObjectToList(obj) { // your code here + } let output = convertObjectToList({ name: 'Holly', age: 35, role: 'producer' }); diff --git a/exercises/149-flipPairs/app.js b/exercises/149-flipPairs/app.js index d43bda8a3..dc55ff373 100644 --- a/exercises/149-flipPairs/app.js +++ b/exercises/149-flipPairs/app.js @@ -5,4 +5,4 @@ function flipPairs(input) { let input = "Can you see what this is about?"; let output = flipPairs(input); -console.log(output); // --> ?tuoba si siht tahw ees uoy naC +console.log(output); // --> aC noy ues ehwtat ih ssia obtu? diff --git a/exercises/149-flipPairs/solution.hide.js b/exercises/149-flipPairs/solution.hide.js index 9a0375fcf..57a09fddc 100644 --- a/exercises/149-flipPairs/solution.hide.js +++ b/exercises/149-flipPairs/solution.hide.js @@ -3,7 +3,7 @@ function flipPairs(input) { let result = input.replace(/(.)(.)/g, '$2$1'); return result; } - + let input = "Can you see what this is about?"; let output = flipPairs(input); -console.log(output); // --> ?tuoba si siht tahw ees uoy naC +console.log(output); // --> aC noy ues ehwtat ih ssia obtu? diff --git a/exercises/153-isRotated/README.es.md b/exercises/153-isRotated/README.es.md index 4ee45e230..6fed74e2d 100644 --- a/exercises/153-isRotated/README.es.md +++ b/exercises/153-isRotated/README.es.md @@ -10,7 +10,7 @@ Una rotaci贸n en un string se define como quitar el primer elemento y concatenar ```js let output = isRotated("Hello World", "orldHello W") -console.log(output) // true +console.log(output) // --> true ``` ## 馃挕 Pista: diff --git a/exercises/153-isRotated/README.md b/exercises/153-isRotated/README.md index 59449ee70..5eb92b362 100644 --- a/exercises/153-isRotated/README.md +++ b/exercises/153-isRotated/README.md @@ -10,7 +10,7 @@ A rotation on a string is defined as removing the first element and concatenatin ```js let output = isRotated("Hello World", "orldHello W") -console.log(output) // true +console.log(output) // --> true ``` ## 馃挕 Hint: diff --git a/exercises/156-isogram/solution.hide.js b/exercises/156-isogram/solution.hide.js index 684b971c5..fc1b8eeff 100644 --- a/exercises/156-isogram/solution.hide.js +++ b/exercises/156-isogram/solution.hide.js @@ -1,7 +1,9 @@ function isIsogram(text) { // your code here + let lowerCaseText = text.toLowerCase() + const chars = {}; - for (const char of text) { + for (const char of lowerCaseText) { chars[char] = (chars[char] || 0) + 1; } let result = Object.entries(chars) diff --git a/exercises/156-isogram/test.js b/exercises/156-isogram/test.js index 9881729fc..6c8d2aee4 100644 --- a/exercises/156-isogram/test.js +++ b/exercises/156-isogram/test.js @@ -24,3 +24,7 @@ test('Function must return true or false if no letters are repeated. Testing wit test('Function must return true or false if no letters are repeated. Testing with different values', () => { expect(isIsogram('Camille')).toBe(false); }); + +test('Function must return true or false if no letters are repeated. Testing with different values', () => { + expect(isIsogram('Cactus')).toBe(false); +}); diff --git a/exercises/157-phoneNumber/README.md b/exercises/157-phoneNumber/README.md index 18530178c..845de066a 100644 --- a/exercises/157-phoneNumber/README.md +++ b/exercises/157-phoneNumber/README.md @@ -2,7 +2,7 @@ ## 馃摑 Instructions: -1. Use the skeleton and modify the functions in order to format the numbers in the following format: `(000) 000-0000` +1. Use the skeleton and modify the functions in order to format the numbers in the following way: `(000) 000-0000` ## 馃搸 Example: diff --git a/exercises/159.1-FashionInventory-A/README.es.md b/exercises/159.1-FashionInventory-A/README.es.md index e374a9ec3..961117f60 100644 --- a/exercises/159.1-FashionInventory-A/README.es.md +++ b/exercises/159.1-FashionInventory-A/README.es.md @@ -41,8 +41,8 @@ let currentInventory = [ ```Js [ - [Brunello Cucinelli, tasselled black low-top lace-up, 1000], - [Brunello Cucinelli, tasselled green low-top lace-up, 1100], + ['Brunello Cucinelli', 'tasselled black low-top lace-up', 1000], + ['Brunello Cucinelli', 'tasselled green low-top lace-up', 1100], ... ] ``` diff --git a/exercises/159.1-FashionInventory-A/README.md b/exercises/159.1-FashionInventory-A/README.md index 5d3109251..a55c82472 100644 --- a/exercises/159.1-FashionInventory-A/README.md +++ b/exercises/159.1-FashionInventory-A/README.md @@ -41,8 +41,8 @@ let currentInventory = [ ```Js [ - [Brunello Cucinelli, tasselled black low-top lace-up, 1000], - [Brunello Cucinelli, tasselled green low-top lace-up, 1100], + ['Brunello Cucinelli', 'tasselled black low-top lace-up', 1000], + ['Brunello Cucinelli', 'tasselled green low-top lace-up', 1100], ... ] ``` diff --git a/exercises/159.2-FashionInventory-B/README.es.md b/exercises/159.2-FashionInventory-B/README.es.md index b94fd3b99..c60938a35 100644 --- a/exercises/159.2-FashionInventory-B/README.es.md +++ b/exercises/159.2-FashionInventory-B/README.es.md @@ -9,12 +9,12 @@ Es la misma estructura de datos de inventario que antes, tienes un cat谩logo de ```Js [ { - 'name': 'Designer Name', - 'averagePrice': 000 + name: 'Designer Name', + averagePrice: 000 }, { - 'name': 'Designer Name', - 'averagePrice': 000 + name: 'Designer Name', + averagePrice: 000 }, ... ] @@ -48,12 +48,12 @@ let currentInventory = [ ```Js [ { - 'name': 'Brunello Cucinelli', - 'averagePrice': 1025 + name: 'Brunello Cucinelli', + averagePrice: 1025 }, { - 'name': 'Gucci', - 'averagePrice': 850 + name: 'Gucci', + averagePrice: 850 } ] ``` diff --git a/exercises/159.2-FashionInventory-B/README.md b/exercises/159.2-FashionInventory-B/README.md index 5e76be268..86f815a7d 100644 --- a/exercises/159.2-FashionInventory-B/README.md +++ b/exercises/159.2-FashionInventory-B/README.md @@ -9,12 +9,12 @@ It's the same inventory data structure as before, you have a fashion catalog, an ```Js [ { - 'name': 'Designer Name', - 'averagePrice': 000 + name: 'Designer Name', + averagePrice: 000 }, { - 'name': 'Designer Name', - 'averagePrice': 000 + name: 'Designer Name', + averagePrice: 000 }, ... ] @@ -49,12 +49,12 @@ let currentInventory = [ ```Js [ { - 'name': 'Brunello Cucinelli', - 'averagePrice': 1025 + name: 'Brunello Cucinelli', + averagePrice: 1025 }, { - 'name': 'Gucci', - 'averagePrice': 850 + name: 'Gucci', + averagePrice: 850 } ] ``` diff --git a/exercises/159.3-FashionInventory-C/README.es.md b/exercises/159.3-FashionInventory-C/README.es.md index 5d4f55d81..06d5d35de 100644 --- a/exercises/159.3-FashionInventory-C/README.es.md +++ b/exercises/159.3-FashionInventory-C/README.es.md @@ -43,8 +43,8 @@ let currentInventory = [ ```Js [ - [Brunello Cucinelli, tasselled black low-top lace-up, 1000], - [Gucci, black leather laced sneakers, 900] + ['Brunello Cucinelli', 'tasselled black low-top lace-up', 1000], + ['Gucci', 'black leather laced sneakers', 900] ] ``` diff --git a/exercises/159.3-FashionInventory-C/README.md b/exercises/159.3-FashionInventory-C/README.md index b78a339bb..44ac44b1d 100644 --- a/exercises/159.3-FashionInventory-C/README.md +++ b/exercises/159.3-FashionInventory-C/README.md @@ -43,8 +43,8 @@ let currentInventory = [ ```Js [ - [Brunello Cucinelli, tasselled black low-top lace-up, 1000], - [Gucci, black leather laced sneakers, 900] + ['Brunello Cucinelli', 'tasselled black low-top lace-up', 1000], + ['Gucci', 'black leather laced sneakers', 900] ] ``` diff --git a/exercises/159.4-FashionInventory-D/README.es.md b/exercises/159.4-FashionInventory-D/README.es.md index 3170e55ca..d6e9ab601 100644 --- a/exercises/159.4-FashionInventory-D/README.es.md +++ b/exercises/159.4-FashionInventory-D/README.es.md @@ -44,40 +44,40 @@ let currentInventory = [ ```js [ { - "nameWords": [ + nameWords: [ "tasselled", "black", "low-top", "lace-up" ], - "targetWordIndex": 3 + targetWordIndex: 3 }, { - "nameWords": [ + nameWords: [ "tasselled", "green", "low-top", "lace-up" ], - "targetWordIndex": 3 + targetWordIndex: 3 }, { - "nameWords": [ + nameWords: [ "red", "leather", "laced", "sneakers" ], - "targetWordIndex": 2 + targetWordIndex: 2 }, { - "nameWords": [ + nameWords: [ "black", "leather", "laced", "sneakers" ], - "targetWordIndex": 2 + targetWordIndex: 2 } ] ``` diff --git a/exercises/159.4-FashionInventory-D/README.md b/exercises/159.4-FashionInventory-D/README.md index 91345c469..e66455715 100644 --- a/exercises/159.4-FashionInventory-D/README.md +++ b/exercises/159.4-FashionInventory-D/README.md @@ -42,40 +42,40 @@ let currentInventory = [ ```js [ { - "nameWords": [ + nameWords: [ "tasselled", "black", "low-top", "lace-up" ], - "targetWordIndex": 3 + targetWordIndex: 3 }, { - "nameWords": [ + nameWords: [ "tasselled", "green", "low-top", "lace-up" ], - "targetWordIndex": 3 + targetWordIndex: 3 }, { - "nameWords": [ + nameWords: [ "red", "leather", "laced", "sneakers" ], - "targetWordIndex": 2 + targetWordIndex: 2 }, { - "nameWords": [ + nameWords: [ "black", "leather", "laced", "sneakers" ], - "targetWordIndex": 2 + targetWordIndex: 2 } ] ```