Skip to content

Commit 2a31489

Browse files
Merge pull request 4GeeksAcademy#194 from josemoracard/jose1-110-getAllButLastElementOfProperty
ejercicios cambios varios
2 parents 2164d02 + efbb1f4 commit 2a31489

File tree

47 files changed

+168
-133
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+168
-133
lines changed

exercises/065-or/README.es.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# `065` or
22

3+
En este ejercicio vamos a replicar el comportamiento del operador lógico OR `||` sin usar el propio operador. ¿Recuerdas cómo funciona?
4+
35
## 📝 Instrucciones:
46

5-
1. Escribe una función llamada `or`. Dadas 2 expresiones booleanas, `or` retorna true o false, correspondiente al operador `||`.
7+
1. Escribe una función llamada `or`. Dadas 2 expresiones booleanas, `or` retorna true o false, siguiendo las reglas del operador `||`.
68

79
## 📎 Ejemplo:
810

exercises/065-or/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# `065` or
22

3+
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?
4+
35
## 📝 Instructions:
46

5-
1. Write a function called `or`. Given 2 boolean expressions, `or` returns true or false, corresponding to the `||` operator.
7+
1. Write a function called `or`. Given 2 boolean expressions, `or` returns true or false, following the rules of the `||` operator.
68

79
## 📎 Example:
810

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
function getLengthOfLongestElement(arr) {
2-
// Your code here
3-
if (arr.length < 1) return 0
4-
else {
5-
let aux = 0
6-
arr.map(item=> item.length > aux ? aux = item.length : null)
7-
return aux;
2+
// your code here
3+
let longestLength = 0;
4+
for (let i = 0; i < arr.length; i++) {
5+
if (arr[i].length > longestLength) {
6+
longestLength = arr[i].length;
87
}
8+
}
9+
10+
return longestLength;
911
}
1012

1113
let output = getLengthOfLongestElement(['one', 'two', 'three']);
12-
console.log(output); // --> 5
14+
console.log(output); // --> 5

exercises/111-getElementOfArrayProperty/README.es.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## 📝 Instrucciones:
44

5-
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.
5+
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.
66

77
## 📎 Ejemplo:
88

exercises/120-getLargestElement/solution.hide.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function getLargestElement(arr) {
22
// your code here
33
if (arr.length < 1) return 0;
44

5-
let aux = 0;
5+
let aux = arr[0];
66
for (let e of arr) {
77
if (aux < e) aux = e;
88
}

exercises/120-getLargestElement/test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ test('Function must return the largest number within the array. Testing with dif
2121
expect(getLargestElement([15, 22, 18, 23])).toBe(23);
2222
});
2323

24+
test('Function must return the largest number within the array. Testing with different values', () => {
25+
expect(getLargestElement([-5, -2, -8, -3])).toBe(-2);
26+
});
27+
2428
test('If array is empty, it should return 0', () => {
2529
let output = getLargestElement([]);
2630
expect(output).toBe(0);

exercises/121-computeSumOfAllElements/solution.hide.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ function computeSumOfAllElements(arr) {
77
return aux;
88
}
99

10-
var output = computeSumOfAllElements([1, 2, 3]);
10+
let output = computeSumOfAllElements([1, 2, 3]);
1111
console.log(output); // --> 6

exercises/124-joinArraysOfArrays/README.es.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## 📝 Instrucciones:
44

5-
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.
5+
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.
66

77
## 📎 Ejemplo:
88

exercises/133-convertScoreToGrade/README.es.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@ console.log(output); // --> 'A'
1313

1414
## 💡 Pistas:
1515

16-
+ (100 - 90) --> 'A'
17-
18-
+ (89 - 80) --> 'B'
19-
20-
+ (79 - 70) --> 'C'
21-
22-
+ (69 - 60) --> 'D'
23-
24-
+ (59 - 0) --> 'F'
16+
| Puntaje | Grado |
17+
|:---------:|:-------:|
18+
| 100 - 90 | 'A' |
19+
| 89 - 80 | 'B' |
20+
| 79 - 70 | 'C' |
21+
| 69 - 60 | 'D' |
22+
| 59 - 0 | 'F' |
2523

2624
+ Si la puntuación dada es mayor que 100 o menor que 0, `convertScoreToGrade` debería retornar `INVALID SCORE`.

exercises/133-convertScoreToGrade/README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@ console.log(output); // --> 'A'
1313

1414
## 💡 Hints:
1515

16-
+ (100 - 90) --> 'A'
17-
18-
+ (89 - 80) --> 'B'
19-
20-
+ (79 - 70) --> 'C'
21-
22-
+ (69 - 60) --> 'D'
23-
24-
+ (59 - 0) --> 'F'
16+
| Score | Grade |
17+
|:---------:|:-------:|
18+
| 100 - 90 | 'A' |
19+
| 89 - 80 | 'B' |
20+
| 79 - 70 | 'C' |
21+
| 69 - 60 | 'D' |
22+
| 59 - 0 | 'F' |
2523

2624
+ If the given score is greater than 100 or less than 0, `convertScoreToGrade` should return `INVALID SCORE`.

0 commit comments

Comments
 (0)