From c056990e4016b122458de47d74fa50c7f90d2078 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 11:10:31 +0200 Subject: [PATCH 01/64] Update README.es.md --- exercises/111-getElementOfArrayProperty/README.es.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: From 8895e40e36d9e48bd0bc8ca9f40c79f3ad8a2d0c Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 11:47:11 +0200 Subject: [PATCH 02/64] Update solution.hide.js --- exercises/120-getLargestElement/solution.hide.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } From cafc0df0cf4b5ee4925394d0cd7bfdfef36eadc1 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 11:48:52 +0200 Subject: [PATCH 03/64] Update test.js --- exercises/120-getLargestElement/test.js | 4 ++++ 1 file changed, 4 insertions(+) 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); From 13a65150d9ba3b48bdec2acc60a97efcc90a6a38 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 11:51:14 +0200 Subject: [PATCH 04/64] Update solution.hide.js --- exercises/121-computeSumOfAllElements/solution.hide.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 94965b5937070b9c87768e3042a7c95c0458ecac Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 12:00:14 +0200 Subject: [PATCH 05/64] Update README.es.md --- exercises/124-joinArraysOfArrays/README.es.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: From a99d8376554a3afe45b4e3245dca31a2bf4f70fc Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 20:14:30 +0200 Subject: [PATCH 06/64] Update README.md --- exercises/133-convertScoreToGrade/README.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/exercises/133-convertScoreToGrade/README.md b/exercises/133-convertScoreToGrade/README.md index e024e315d..266a59add 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`. From fa0e0fea2bf929d05fea7e0fc4e875374108ce72 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 20:16:07 +0200 Subject: [PATCH 07/64] Update README.md --- exercises/133-convertScoreToGrade/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/133-convertScoreToGrade/README.md b/exercises/133-convertScoreToGrade/README.md index 266a59add..b4c2b6350 100644 --- a/exercises/133-convertScoreToGrade/README.md +++ b/exercises/133-convertScoreToGrade/README.md @@ -14,7 +14,7 @@ console.log(output); // --> 'A' ## 馃挕 Hints: | Score | Grade | -|---------- |------- | +|:---------:|:-------:| | 100 - 90 | 'A' | | 89 - 80 | 'B' | | 79 - 70 | 'C' | From 8106c3f10c831f533f90eca6f0e8c5d96a4ab8d0 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 20:17:19 +0200 Subject: [PATCH 08/64] Update README.es.md --- exercises/133-convertScoreToGrade/README.es.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/exercises/133-convertScoreToGrade/README.es.md b/exercises/133-convertScoreToGrade/README.es.md index 9d3f6d810..4f6ed9037 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`. From e0362424e262491625772babf1c0471b70c3012c Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 20:20:50 +0200 Subject: [PATCH 09/64] Update README.es.md --- exercises/133-convertScoreToGrade/README.es.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/133-convertScoreToGrade/README.es.md b/exercises/133-convertScoreToGrade/README.es.md index 4f6ed9037..b08c218cd 100644 --- a/exercises/133-convertScoreToGrade/README.es.md +++ b/exercises/133-convertScoreToGrade/README.es.md @@ -13,7 +13,7 @@ console.log(output); // --> 'A' ## 馃挕 Pistas: -| Puntaje | Grado | +| Puntaje | Grado | |:---------:|:-------:| | 100 - 90 | 'A' | | 89 - 80 | 'B' | From 485cc28d0fddc01b16effcc4a795d78222efc1d2 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 20:22:23 +0200 Subject: [PATCH 10/64] Update README.md --- .../134-convertScoreToGradeWithPlus/README.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) 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`. From a5027ce43af2f71de0485bd1090b68b916703e51 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 20:24:32 +0200 Subject: [PATCH 11/64] Update README.es.md --- .../134-convertScoreToGradeWithPlus/README.es.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) 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`. From 9c5803d48fa0cb177a19f7004074d0cbbd7579e5 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 20:33:50 +0200 Subject: [PATCH 12/64] Update solution.hide.js --- exercises/135-computeFactorialOfN/solution.hide.js | 3 --- 1 file changed, 3 deletions(-) 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 From d24fa2c68347aedafa7185fedbe1242782c459ec Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 20:33:56 +0200 Subject: [PATCH 13/64] Update app.js --- exercises/135-computeFactorialOfN/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 7599dcaeb28b892b93167d453df0d9d2bae389ed Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 20:58:45 +0200 Subject: [PATCH 14/64] Update README.md --- exercises/139-computeCompoundInterest/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) From 41e3dcd15a4a99c4c6174659ad61d662b20496d6 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 21:01:57 +0200 Subject: [PATCH 15/64] Update README.es.md --- exercises/139-computeCompoundInterest/README.es.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) From 48b05030c1c8895ce4413b9114d41dd26966f4fd Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 21:31:41 +0200 Subject: [PATCH 16/64] Update solution.hide.js --- exercises/141-multiply/solution.hide.js | 28 +++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) 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); From 1f3bc85230c879ff5d2777c6dc62f9b9d4b2acf9 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 21:36:14 +0200 Subject: [PATCH 17/64] Update test.js --- exercises/141-multiply/test.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/exercises/141-multiply/test.js b/exercises/141-multiply/test.js index ffad8a6c6..4e5cb6f35 100644 --- a/exercises/141-multiply/test.js +++ b/exercises/141-multiply/test.js @@ -17,10 +17,18 @@ test('Given 2 whole 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 whole numbers, multiply and return the total. Testing with different values', () => { expect(multiply(5, -5)).toBe(-25); }); +test('Given 2 whole numbers, multiply and return the total. Testing with different values', () => { + expect(multiply(-5, -3)).toBe(15); +}); + +test('Given 2 whole 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); From dac29b4f8d0c226369b485cf6f8aae613c42976b Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 21:38:28 +0200 Subject: [PATCH 18/64] Update test.js --- exercises/141-multiply/test.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exercises/141-multiply/test.js b/exercises/141-multiply/test.js index 4e5cb6f35..fb1fadce1 100644 --- a/exercises/141-multiply/test.js +++ b/exercises/141-multiply/test.js @@ -13,19 +13,19 @@ 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 different values', () => { +test('Given 2 integer numbers, multiply and return the total. Testing with different values', () => { expect(multiply(5, -5)).toBe(-25); }); -test('Given 2 whole numbers, multiply and return the total. Testing with different values', () => { +test('Given 2 integer numbers, multiply and return the total. Testing with different values', () => { expect(multiply(-5, -3)).toBe(15); }); -test('Given 2 whole numbers, multiply and return the total. Testing with different values', () => { +test('Given 2 integer numbers, multiply and return the total. Testing with different values', () => { expect(multiply(0, -5)).toBe(0); }); From 2bf622160854e251fd9cd791fe40f7a8b6f54503 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 21:45:03 +0200 Subject: [PATCH 19/64] Update README.es.md --- exercises/140-modulo/README.es.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. From bad6c67856cc3ad12dbfe2ac4e0031a8d2afd93c Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 21:57:39 +0200 Subject: [PATCH 20/64] Update solution.hide.js --- exercises/140-modulo/solution.hide.js | 4 ++++ 1 file changed, 4 insertions(+) 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) { From f6e5261ef11e6e8a991e31b8da5e83871488e5b6 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 22:09:54 +0200 Subject: [PATCH 21/64] Update solution.hide.js --- exercises/142-isOddWithoutModulo/solution.hide.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/142-isOddWithoutModulo/solution.hide.js b/exercises/142-isOddWithoutModulo/solution.hide.js index d3d1130c3..611e67a0e 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; } From b40e72344df26259d931e9bb3a201b686baf22ac Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 22:27:47 +0200 Subject: [PATCH 22/64] Update solution.hide.js --- exercises/142-isOddWithoutModulo/solution.hide.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/142-isOddWithoutModulo/solution.hide.js b/exercises/142-isOddWithoutModulo/solution.hide.js index 611e67a0e..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; } From cbf3707b649a43dd867d746d94a9031e835d84d3 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 22:28:32 +0200 Subject: [PATCH 23/64] Update solution.hide.js --- exercises/143-isEvenWithoutModulo/solution.hide.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/143-isEvenWithoutModulo/solution.hide.js b/exercises/143-isEvenWithoutModulo/solution.hide.js index dde8c1b12..783e7ba46 100644 --- a/exercises/143-isEvenWithoutModulo/solution.hide.js +++ b/exercises/143-isEvenWithoutModulo/solution.hide.js @@ -14,4 +14,4 @@ function isEvenWithoutModulo(num) { } let output = isEvenWithoutModulo(18); -console.log(output); // --> false +console.log(output); // --> true From 3e34d18563b766ad8873941baf0619bf1edc90f6 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 22:28:47 +0200 Subject: [PATCH 24/64] Update solution.hide.js --- exercises/143-isEvenWithoutModulo/solution.hide.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/143-isEvenWithoutModulo/solution.hide.js b/exercises/143-isEvenWithoutModulo/solution.hide.js index 783e7ba46..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); +let output = isEvenWithoutModulo(8); console.log(output); // --> true From 5fc6a7257fad194b66d78a0a13d9912b507e816e Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Tue, 11 Jul 2023 22:29:45 +0200 Subject: [PATCH 25/64] Update test.js --- exercises/143-isEvenWithoutModulo/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); }); From ae75a3e1c29d149624b1e2162b12d9953b480520 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 03:56:02 +0200 Subject: [PATCH 26/64] Update README.es.md --- exercises/146.1-ArrayToObject/README.es.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/146.1-ArrayToObject/README.es.md b/exercises/146.1-ArrayToObject/README.es.md index 6c8d05e76..0622c08d8 100644 --- a/exercises/146.1-ArrayToObject/README.es.md +++ b/exercises/146.1-ArrayToObject/README.es.md @@ -2,7 +2,7 @@ ## 馃摑 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: @@ -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. From 7f51e3455e5cb80308df57d7975faad064a75b26 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 03:56:19 +0200 Subject: [PATCH 27/64] Update README.md --- exercises/146.1-ArrayToObject/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/146.1-ArrayToObject/README.md b/exercises/146.1-ArrayToObject/README.md index a5c235faf..8190bd076 100644 --- a/exercises/146.1-ArrayToObject/README.md +++ b/exercises/146.1-ArrayToObject/README.md @@ -2,7 +2,7 @@ ## 馃摑 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: From 17c3126148c836a4088b64cc1a9bf2f9ecd16e36 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 03:57:03 +0200 Subject: [PATCH 28/64] Update README.md --- exercises/146.1-ArrayToObject/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/146.1-ArrayToObject/README.md b/exercises/146.1-ArrayToObject/README.md index 8190bd076..cf6d5fb06 100644 --- a/exercises/146.1-ArrayToObject/README.md +++ b/exercises/146.1-ArrayToObject/README.md @@ -8,14 +8,14 @@ ```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: From b386afcce3b5f5579c54dae5327c61258cd508e1 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 03:57:13 +0200 Subject: [PATCH 29/64] Update README.es.md --- exercises/146.1-ArrayToObject/README.es.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/146.1-ArrayToObject/README.es.md b/exercises/146.1-ArrayToObject/README.es.md index 0622c08d8..5de903af7 100644 --- a/exercises/146.1-ArrayToObject/README.es.md +++ b/exercises/146.1-ArrayToObject/README.es.md @@ -8,14 +8,14 @@ ```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: From 473aa820dddac57fc6644f8e6503a43d8fcc9550 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 03:59:02 +0200 Subject: [PATCH 30/64] Update README.md --- exercises/146.2-ArrayToObject/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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: From e5202e550fa4189a22316cb432afddc3902d6630 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 03:59:46 +0200 Subject: [PATCH 31/64] Update README.es.md --- exercises/146.2-ArrayToObject/README.es.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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: From b3a6e4df1ff82c2f41c6efe3e2744b70061f4a3b Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 04:04:52 +0200 Subject: [PATCH 32/64] Update README.md --- exercises/146.3-ArrayToObject/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/146.3-ArrayToObject/README.md b/exercises/146.3-ArrayToObject/README.md index f8be6e8d5..ae957e09c 100644 --- a/exercises/146.3-ArrayToObject/README.md +++ b/exercises/146.3-ArrayToObject/README.md @@ -1,4 +1,4 @@ -# `146.3` ArraytoObject +# `146.3` ArrayToObject ## 馃摑 Instructions: From ce6b9b398f2cef76cbcf5e04d0c69a63f04e0c57 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 04:06:02 +0200 Subject: [PATCH 33/64] Update README.es.md --- exercises/146.3-ArrayToObject/README.es.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/146.3-ArrayToObject/README.es.md b/exercises/146.3-ArrayToObject/README.es.md index bbf9e12e2..4452f80e5 100644 --- a/exercises/146.3-ArrayToObject/README.es.md +++ b/exercises/146.3-ArrayToObject/README.es.md @@ -1,4 +1,4 @@ -# `146.3` ArraytoObject +# `146.3` ArrayToObject ## 馃摑 Instrucciones: From c1274826c46044759771d08b73fe5f5a3b5aace1 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 04:07:35 +0200 Subject: [PATCH 34/64] Update app.js --- exercises/146.3-ArrayToObject/app.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/exercises/146.3-ArrayToObject/app.js b/exercises/146.3-ArrayToObject/app.js index fd435eeff..232ecdc09 100644 --- a/exercises/146.3-ArrayToObject/app.js +++ b/exercises/146.3-ArrayToObject/app.js @@ -2,3 +2,20 @@ function transformEmployeeData(array) { // your code here } + +let output = transformEmployeeData([ + [ + ['firstName', 'Joe'], + ['lastName', 'Blow'], + ['age', 42], + ['role', 'clerk'], + ], + [ + ['firstName', 'Mary'], + ['lastName', 'Jenkins'], + ['age', 36], + ['role', 'manager'], + ], +]); + +console.log(output); From c37e9bff3101eb9d2df4a4ea57dfb1158c7e0fc6 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 04:12:37 +0200 Subject: [PATCH 35/64] Update app.js --- exercises/146.3-ArrayToObject/app.js | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/exercises/146.3-ArrayToObject/app.js b/exercises/146.3-ArrayToObject/app.js index 232ecdc09..fd435eeff 100644 --- a/exercises/146.3-ArrayToObject/app.js +++ b/exercises/146.3-ArrayToObject/app.js @@ -2,20 +2,3 @@ function transformEmployeeData(array) { // your code here } - -let output = transformEmployeeData([ - [ - ['firstName', 'Joe'], - ['lastName', 'Blow'], - ['age', 42], - ['role', 'clerk'], - ], - [ - ['firstName', 'Mary'], - ['lastName', 'Jenkins'], - ['age', 36], - ['role', 'manager'], - ], -]); - -console.log(output); From bd6a4a47aa775056fc0766075bfe9d37de0aa7b4 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 04:18:36 +0200 Subject: [PATCH 36/64] Update README.md --- exercises/146.3-ArrayToObject/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/146.3-ArrayToObject/README.md b/exercises/146.3-ArrayToObject/README.md index ae957e09c..ab1dc1239 100644 --- a/exercises/146.3-ArrayToObject/README.md +++ b/exercises/146.3-ArrayToObject/README.md @@ -2,7 +2,7 @@ ## 馃摑 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 a given employee data from one format to another. ## 馃搸 Example: From 937c9a2c17f60c1da599a42b5d0c58faca39787b Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 04:19:10 +0200 Subject: [PATCH 37/64] Update README.es.md --- exercises/146.3-ArrayToObject/README.es.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/146.3-ArrayToObject/README.es.md b/exercises/146.3-ArrayToObject/README.es.md index 4452f80e5..757718e85 100644 --- a/exercises/146.3-ArrayToObject/README.es.md +++ b/exercises/146.3-ArrayToObject/README.es.md @@ -2,7 +2,7 @@ ## 馃摑 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: From 8b548dd4855a50b9696221ce09c06b2f4aeb313d Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 04:19:27 +0200 Subject: [PATCH 38/64] Update README.md --- exercises/146.3-ArrayToObject/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/146.3-ArrayToObject/README.md b/exercises/146.3-ArrayToObject/README.md index ab1dc1239..421e4d217 100644 --- a/exercises/146.3-ArrayToObject/README.md +++ b/exercises/146.3-ArrayToObject/README.md @@ -2,7 +2,7 @@ ## 馃摑 Instructions: -1. Write a function called `transformEmployeeData` that transforms a given employee data from one format to another. +1. Write a function called `transformEmployeeData` that transforms employee data from one format to another. ## 馃搸 Example: From 016a692112b236c70bf47433aaaa5ab5fc1875d3 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 04:22:53 +0200 Subject: [PATCH 39/64] Update solution.hide.js --- exercises/147.1-ObjectToArray/solution.hide.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 2f1d63086f8a82686fd9ad6b93bbfcb4896a694d Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 04:31:24 +0200 Subject: [PATCH 40/64] Update app.js --- exercises/147.2-ObjectToArray/app.js | 1 + 1 file changed, 1 insertion(+) 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 }); From 88f5b4426ac60ecff7a21cf3578ff4df7e0c0521 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 04:41:59 +0200 Subject: [PATCH 41/64] Update app.js --- exercises/147.3-ObjectToArray/app.js | 1 + 1 file changed, 1 insertion(+) 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' }); From 27f64bff4e33e46e14ee549a3bfb4b38d53c68f2 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 05:14:21 +0200 Subject: [PATCH 42/64] Update solution.hide.js --- exercises/149-flipPairs/solution.hide.js | 30 ++++++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/exercises/149-flipPairs/solution.hide.js b/exercises/149-flipPairs/solution.hide.js index 9a0375fcf..ad946d174 100644 --- a/exercises/149-flipPairs/solution.hide.js +++ b/exercises/149-flipPairs/solution.hide.js @@ -1,9 +1,29 @@ function flipPairs(input) { - // your code here - let result = input.replace(/(.)(.)/g, '$2$1'); - return result; + // your code here + let flippedString = ''; + + for (let i = 0; i < input.length; i += 2) { + if (i + 1 < input.length) { + flippedString += input[i + 1] + input[i]; + } else { + flippedString += input[i]; + } } - + + return flippedString; +} + 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? + +/* // Solution 2: + +function flipPairs(input) { + // This solution is using Regular Expressions or RegExp + let result = input.replace(/(.)(.)/g, '$2$1'); + return result; + } + +*/ + From c5857279032e44a4c9fca308be7254f740e99e52 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 05:15:43 +0200 Subject: [PATCH 43/64] Update app.js --- exercises/149-flipPairs/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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? From c46b500ab91ab58e0915dc94b40ab28b09c8cb39 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 05:21:29 +0200 Subject: [PATCH 44/64] Update solution.hide.js --- exercises/149-flipPairs/solution.hide.js | 27 ++++-------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/exercises/149-flipPairs/solution.hide.js b/exercises/149-flipPairs/solution.hide.js index ad946d174..2cbfbd88f 100644 --- a/exercises/149-flipPairs/solution.hide.js +++ b/exercises/149-flipPairs/solution.hide.js @@ -1,29 +1,10 @@ function flipPairs(input) { - // your code here - let flippedString = ''; - - for (let i = 0; i < input.length; i += 2) { - if (i + 1 < input.length) { - flippedString += input[i + 1] + input[i]; - } else { - flippedString += input[i]; - } - } - - return flippedString; -} - -let input = "Can you see what this is about?"; -let output = flipPairs(input); -console.log(output); // --> aC noy ues ehwtat ih ssia obtu? - -/* // Solution 2: - -function flipPairs(input) { - // This solution is using Regular Expressions or RegExp + // your code here 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); // --> aC noy ues ehwtat ih ssia obtu? From c9053514a1426a9eab27bcf3437025cbe0342196 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 05:21:48 +0200 Subject: [PATCH 45/64] Update solution.hide.js --- exercises/149-flipPairs/solution.hide.js | 1 - 1 file changed, 1 deletion(-) diff --git a/exercises/149-flipPairs/solution.hide.js b/exercises/149-flipPairs/solution.hide.js index 2cbfbd88f..57a09fddc 100644 --- a/exercises/149-flipPairs/solution.hide.js +++ b/exercises/149-flipPairs/solution.hide.js @@ -4,7 +4,6 @@ function flipPairs(input) { return result; } - let input = "Can you see what this is about?"; let output = flipPairs(input); console.log(output); // --> aC noy ues ehwtat ih ssia obtu? From 24cfbc0568ddaf4302b8eabd1af43b55e9808fc6 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 05:38:05 +0200 Subject: [PATCH 46/64] Update README.md --- exercises/153-isRotated/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: From 331ac85ef01ea35ce4ce3f7874e6afb280a5d789 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 05:38:14 +0200 Subject: [PATCH 47/64] Update README.es.md --- exercises/153-isRotated/README.es.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: From 63bebebae5299bf5aa1fd1de8e921f40d23bcf6c Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 06:10:03 +0200 Subject: [PATCH 48/64] Update README.md --- exercises/157-phoneNumber/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: From f57c2755730ec24d43db0248a847b2eef2c2ff06 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 06:22:51 +0200 Subject: [PATCH 49/64] Update solution.hide.js --- exercises/156-isogram/solution.hide.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) From e9a92c913b3dcc69f7ede170e233209e05a4ea5d Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 06:25:03 +0200 Subject: [PATCH 50/64] Update test.js --- exercises/156-isogram/test.js | 4 ++++ 1 file changed, 4 insertions(+) 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); +}); From dd221122765cc5b780ba9fde8d90a44a4e9c2d31 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 16:18:13 +0200 Subject: [PATCH 51/64] Update README.md --- exercises/159.2-FashionInventory-B/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 } ] ``` From a67fba149b701c30c65d3a74672f1c1403818f1d Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 16:19:10 +0200 Subject: [PATCH 52/64] Update README.es.md --- exercises/159.2-FashionInventory-B/README.es.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 } ] ``` From 7e4fb50f471cc72e796ecbf160a6c3f3b4ce3314 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 16:23:14 +0200 Subject: [PATCH 53/64] Update README.md --- exercises/159.1-FashionInventory-A/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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], ... ] ``` From 39e880eedc09fb0661e507c1aef962b0d44ed5c0 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 16:23:35 +0200 Subject: [PATCH 54/64] Update README.es.md --- exercises/159.1-FashionInventory-A/README.es.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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], ... ] ``` From 31dd670051805ce27d35eaf6554d06d2f55c6975 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 16:24:31 +0200 Subject: [PATCH 55/64] Update README.md --- exercises/159.3-FashionInventory-C/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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] ] ``` From 29aa45165c0caaca4d5c50bf363c958a2b8d2a15 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 16:25:07 +0200 Subject: [PATCH 56/64] Update README.es.md --- exercises/159.3-FashionInventory-C/README.es.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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] ] ``` From 51513f332e7ec64c9380e8c92710c64a9c53938f Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 16:30:16 +0200 Subject: [PATCH 57/64] Update README.md --- exercises/159.4-FashionInventory-D/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 } ] ``` From f606be5583b1b6eb7475ba88d369ce085c027df9 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 16:30:55 +0200 Subject: [PATCH 58/64] Update README.es.md --- exercises/159.4-FashionInventory-D/README.es.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 } ] ``` From 44731d7c2a93277373febfb2a6e420db0af6e4c6 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 17:14:40 +0200 Subject: [PATCH 59/64] Update README.md --- exercises/065-or/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exercises/065-or/README.md b/exercises/065-or/README.md index ce058587a..9f47bec46 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 OR operator `||` 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: From e426560419f8f1123c54f0291b7ba734eabd6e4c Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 17:26:13 +0200 Subject: [PATCH 60/64] Update README.es.md --- exercises/065-or/README.es.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exercises/065-or/README.es.md b/exercises/065-or/README.es.md index 4fb5459a2..234a96c72 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 de 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: From 1e10416c841b64f78b142907e37934ec813c1e06 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 17:28:03 +0200 Subject: [PATCH 61/64] Update README.md --- exercises/065-or/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/065-or/README.md b/exercises/065-or/README.md index 9f47bec46..b65b76c81 100644 --- a/exercises/065-or/README.md +++ b/exercises/065-or/README.md @@ -1,6 +1,6 @@ # `065` or -In this exercise, we are going to replicate the behavior of the OR operator `||` without actually using the operator itself. Do you remember how it works? +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: From 6dc4a7c64a4657ae8e203d471f3a7931c49fbd67 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 17:34:18 +0200 Subject: [PATCH 62/64] Update README.es.md --- exercises/065-or/README.es.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/065-or/README.es.md b/exercises/065-or/README.es.md index 234a96c72..11aac312f 100644 --- a/exercises/065-or/README.es.md +++ b/exercises/065-or/README.es.md @@ -1,6 +1,6 @@ # `065` or -En este ejercicio vamos a replicar el comportamiento de operador l贸gico OR `||` sin usar el propio operador. 驴Recuerdas c贸mo funciona? +En este ejercicio vamos a replicar el comportamiento del operador l贸gico OR `||` sin usar el propio operador. 驴Recuerdas c贸mo funciona? ## 馃摑 Instrucciones: From 6927a96828f9145b97eae0e944efbc473369fc86 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 12 Jul 2023 21:05:21 +0200 Subject: [PATCH 63/64] Update solution.hide.js --- .../solution.hide.js | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/exercises/107-getLengthOfLongestElement/solution.hide.js b/exercises/107-getLengthOfLongestElement/solution.hide.js index b7146acf0..e74883a86 100644 --- a/exercises/107-getLengthOfLongestElement/solution.hide.js +++ b/exercises/107-getLengthOfLongestElement/solution.hide.js @@ -1,12 +1,18 @@ 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 + if (arr.length === 0) { + return 0; + } + + 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 From efbb1f44b6db5f5e5346938b5398d95650ab05ef Mon Sep 17 00:00:00 2001 From: Tomas Gonzalez <56565994+tommygonzaleza@users.noreply.github.com> Date: Wed, 12 Jul 2023 17:01:54 -0400 Subject: [PATCH 64/64] Update solution.hide.js --- exercises/107-getLengthOfLongestElement/solution.hide.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/exercises/107-getLengthOfLongestElement/solution.hide.js b/exercises/107-getLengthOfLongestElement/solution.hide.js index e74883a86..68747b76a 100644 --- a/exercises/107-getLengthOfLongestElement/solution.hide.js +++ b/exercises/107-getLengthOfLongestElement/solution.hide.js @@ -1,9 +1,5 @@ function getLengthOfLongestElement(arr) { // your code here - if (arr.length === 0) { - return 0; - } - let longestLength = 0; for (let i = 0; i < arr.length; i++) { if (arr[i].length > longestLength) {