Skip to content

Commit 8b7d2ea

Browse files
reported problems solved
1 parent 87da964 commit 8b7d2ea

File tree

305 files changed

+6474
-6483
lines changed

Some content is hidden

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

305 files changed

+6474
-6483
lines changed

M03 HTML/homework.md renamed to C3 HTML/homework.md

Lines changed: 25 additions & 21 deletions
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

C6 Bucles/ejercicios/20.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function sumarHastaNConBreak(n) {
2+
// La función recibe un numero n por argumento.
3+
// Devuelve la suma de todos los números desde 1 hasta n.
4+
// Si la suma supera a 100, detén el bucle usando break.
5+
// Tu código:
6+
}
7+
8+
module.exports = sumarHastaNConBreak;
File renamed without changes.

C6 Bucles/ejercicios/22.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function combine(str1, str2, str3) {
2+
// Esta función debe combinar de forma alternada cada caracter de cada string.
3+
// La función recibe 3 argumentos. Solo debe contabilizar aquellos que NO esten vacíos.
4+
// Los strings pueden tener cualquier tamaño.
5+
// EJEMPLOS
6+
// combine("abc", "", "123") == "a1b2c3"
7+
// combine("abc", "12345", "") == "a1b2c345"
8+
// combine("abc", "12345", "67") == "a16b27c345"
9+
}
10+
11+
module.exports = combine;
File renamed without changes.

C6 Bucles/ejercicios/24.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function invertirTexto(texto) {
2+
// La función recibe un argumento "texto" que es un string.
3+
// Tu objetivo es invertir el string y devolver el string invertido.
4+
// Tu código:
5+
}
6+
7+
module.exports = invertirTexto;

C6 Bucles/ejercicios/25.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
function esPalindromo(string) {
2+
// La función recibe un argumento "string".
3+
// Verifica si este string es palíndromo o no.
4+
// Retorna true si lo es, caso contrario, retorna false.
5+
// IMPORTANTE: Un palíndromo es una palabra o frase
6+
// que se lee igual hacia adelante que hacia atrás.
7+
// Tu código:
8+
}
9+
10+
module.exports = esPalindromo;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

C6 Bucles/tests/M6T20.test.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const sumarHastaNConBreak = require('../ejercicios/20.js');
2+
3+
test('sumarHastaNConBreak of 5 should return 15', () => {
4+
expect(sumarHastaNConBreak(5)).toBe(15);
5+
});
6+
7+
test('sumarHastaNConBreak of 7 should return 28', () => {
8+
expect(sumarHastaNConBreak(7)).toBe(28);
9+
});
10+
11+
test('sumarHastaNConBreak of 10 should return 55', () => {
12+
expect(sumarHastaNConBreak(10)).toBe(55);
13+
});
14+
15+
test('sumarHastaNConBreak of 15 should return 105', () => {
16+
expect(sumarHastaNConBreak(15)).toBe(105);
17+
});
18+
19+
test('sumarHastaNConBreak of 20 should return 105', () => {
20+
expect(sumarHastaNConBreak(20)).toBe(105);
21+
});
22+
23+
test('sumarHastaNConBreak of 50 should return 105', () => {
24+
expect(sumarHastaNConBreak(50)).toBe(105);
25+
});
File renamed without changes.

C6 Bucles/tests/M6T22.test.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
const combine = require('../ejercicios/22');
2+
3+
// describe('diasEnMes', () => {
4+
// it('should return 31 for January', () => {
5+
// expect(diasEnMes(1)).toBe(31);
6+
// });
7+
8+
// it('should return 28 for February', () => {
9+
// expect(diasEnMes(2)).toBe(28);
10+
// });
11+
12+
// it('should return 30 for April', () => {
13+
// expect(diasEnMes(4)).toBe(30);
14+
// });
15+
16+
// it('should return 0 for month outside of range', () => {
17+
// expect(diasEnMes(13)).toBe(0);
18+
// });
19+
20+
// it('should return 0 for month outside of range', () => {
21+
// expect(diasEnMes(-1)).toBe(0);
22+
// });
23+
// });
24+
25+
describe('combine', () => {
26+
test('Debe combinar los caracteres de forma alternada si hay un string vacío', () => {
27+
expect(combine('abc', '', '123')).toBe('a1b2c3');
28+
expect(combine('abc', '12345', '')).toBe('a1b2c345');
29+
});
30+
31+
test('Debe combinar correctamente los resultas si los strings tienen diferente tamaño', () => {
32+
expect(combine('abc', '12345', '')).toBe('a1b2c345');
33+
expect(combine('a', '12', 'xyz')).toBe('a1x2yz');
34+
});
35+
36+
test('Debe retornar un string vacío si todos los strings están vacíos', () => {
37+
expect(combine('', '', '')).toBe('');
38+
});
39+
40+
test('De procesar strings de tamaño 1 correctamente', () => {
41+
expect(combine('a', 'b', 'c')).toBe('abc');
42+
});
43+
44+
test('Debe retornar el resultado correcto si cualquier string está vacío', () => {
45+
expect(combine('abc', '', '')).toBe('abc');
46+
expect(combine('', '123', '')).toBe('123');
47+
expect(combine('', '', 'xyz')).toBe('xyz');
48+
});
49+
});
File renamed without changes.
File renamed without changes.

C6 Bucles/tests/M6T25.test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const esPalindromo = require('../ejercicios/25');
2+
3+
test("esPalindromo devuelve true para 'ana'", () => {
4+
expect(esPalindromo('ana')).toBe(true);
5+
});
6+
7+
test("esPalindromo devuelve true para 'reconocer'", () => {
8+
expect(esPalindromo('reconocer')).toBe(true);
9+
});
10+
11+
test("esPalindromo devuelve false para 'hola'", () => {
12+
expect(esPalindromo('hola')).toBe(false);
13+
});
14+
15+
test("esPalindromo devuelve false para 'javascript'", () => {
16+
expect(esPalindromo('javascript')).toBe(false);
17+
});
18+
19+
test("esPalindromo devuelve false para 'No subas, abusón'", () => {
20+
expect(esPalindromo('No subas, abusón')).toBe(false);
21+
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

C7 Arrays/ejercicios/08.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function encontrarElemento(num, array) {
2+
// Busca el número pasado por argumento dentro del array.
3+
// Si lo encuentras debes retornar el INDICE en el que se encuentra dentro del array.
4+
// Si no se encuentra, retorna -1.
5+
// Tu código:
6+
}
7+
8+
module.exports = encontrarElemento;

C7 Arrays/ejercicios/09.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function obtenerElementoAleatorio(array) {
2+
// Devuelve un elemento aleatorio del arreglo array.
3+
// PISTA: Usa el método Math.random().
4+
// Tu código:
5+
}
6+
7+
module.exports = obtenerElementoAleatorio;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

C7 Arrays/tests/M7T1.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const devolverPrimerElemento = require('../ejercicios/01');
2+
3+
test('Debe retornar el primer elemento del arreglo', function () {
4+
expect(devolverPrimerElemento([10, 10, 16, 12])).toBe(10);
5+
expect(devolverPrimerElemento([97, 100, 80, 55, 72, 94])).toBe(97);
6+
});

C7 Arrays/tests/M7T10.test.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
const obtenerPrimerStringLargo = require('../ejercicios/10');
2+
3+
describe('obtenerPrimerStringLargo', () => {
4+
it('should return the first string with more than 5 characters', () => {
5+
expect(
6+
obtenerPrimerStringLargo(['hello', 'world', 'this', 'is', 'a', 'test'])
7+
).toBe('hello');
8+
expect(
9+
obtenerPrimerStringLargo([
10+
'this',
11+
'is',
12+
'a',
13+
'test',
14+
'with',
15+
'a',
16+
'long',
17+
'string',
18+
])
19+
).toBe('string');
20+
});
21+
22+
it('should return undefined if no string with more than 5 characters is found', () => {
23+
expect(
24+
obtenerPrimerStringLargo(['hi', 'there', 'how', 'are', 'you'])
25+
).toBeUndefined();
26+
expect(
27+
obtenerPrimerStringLargo(['this', 'is', 'a', 'test'])
28+
).toBeUndefined();
29+
});
30+
});

C7 Arrays/tests/M7T11.test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const duplicarElementos = require('../ejercicios/11.js');
2+
3+
describe('duplicarElementos', () => {
4+
it('should return an array with each element multiplied by 2', () => {
5+
expect(duplicarElementos([1, 2, 3])).toEqual([2, 4, 6]);
6+
expect(duplicarElementos([0, 4, 8])).toEqual([0, 8, 16]);
7+
expect(duplicarElementos([-1, -2, -3])).toEqual([-2, -4, -6]);
8+
});
9+
10+
it('should return an empty array if the input array is empty', () => {
11+
expect(duplicarElementos([])).toEqual([]);
12+
});
13+
});

C7 Arrays/tests/M7T12.test.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const convertirStringAMayusculas = require('../ejercicios/12.js');
2+
3+
test('convertirStringAMayusculas function exists', () => {
4+
expect(convertirStringAMayusculas).toBeDefined();
5+
});
6+
7+
test('convertirStringAMayusculas returns an array', () => {
8+
const result = convertirStringAMayusculas(['hello', 'world']);
9+
expect(Array.isArray(result)).toBeTruthy();
10+
});
11+
12+
test('convertirStringAMayusculas converts strings to uppercase', () => {
13+
const result = convertirStringAMayusculas(['hello', 'world']);
14+
expect(result).toEqual(['HELLO', 'WORLD']);
15+
});
16+
17+
test('convertirStringAMayusculas handles empty array', () => {
18+
const result = convertirStringAMayusculas([]);
19+
expect(result).toEqual([]);
20+
});
21+
22+
test('convertirStringAMayusculas handles array with one element', () => {
23+
const result = convertirStringAMayusculas(['hello']);
24+
expect(result).toEqual(['HELLO']);
25+
});

C7 Arrays/tests/M7T13.test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const filtrarNumerosPares = require('../ejercicios/13');
2+
3+
describe('filtrarNumerosPares', () => {
4+
test('returns an empty array when given an empty array', () => {
5+
expect(filtrarNumerosPares([])).toEqual([]);
6+
});
7+
8+
test('returns an empty array when given an array of only odd numbers', () => {
9+
expect(filtrarNumerosPares([1, 3, 5])).toEqual([]);
10+
});
11+
12+
test('returns an array of only even numbers when given an array of only even numbers', () => {
13+
expect(filtrarNumerosPares([2, 4, 6])).toEqual([2, 4, 6]);
14+
});
15+
16+
test('returns an array of only even numbers when given an array of mixed numbers', () => {
17+
expect(filtrarNumerosPares([1, 2, 3, 4, 5, 6])).toEqual([2, 4, 6]);
18+
});
19+
});

C7 Arrays/tests/M7T14.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const contarElementosMayoresA10 = require('../ejercicios/14');
2+
3+
test('contarElementosMayoresA10 devuelve la cantidad correcta de elementos mayores a 10', () => {
4+
expect(contarElementosMayoresA10([1, 2, 3, 4, 5])).toBe(0);
5+
expect(contarElementosMayoresA10([10, 20, 30, 40, 50])).toBe(4);
6+
expect(contarElementosMayoresA10([11, 12, 13, 14, 15])).toBe(5);
7+
expect(contarElementosMayoresA10([-1, 0, 1, 2, 3])).toBe(0);
8+
});
9+
10+
test('contarElementosMayoresA10 devuelve 0 para un array vacío', () => {
11+
expect(contarElementosMayoresA10([])).toBe(0);
12+
});

C7 Arrays/tests/M7T15.test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const encontrarIndiceMayor = require('../ejercicios/15');
2+
3+
test('encuentra el índice del número más grande en un array', () => {
4+
expect(encontrarIndiceMayor([1, 2, 3, 4, 5])).toBe(4);
5+
expect(encontrarIndiceMayor([5, 4, 3, 2, 1])).toBe(0);
6+
expect(encontrarIndiceMayor([1, 3, 2, 5, 4])).toBe(3);
7+
expect(encontrarIndiceMayor([-1, -2, -3, -4, -5])).toBe(0);
8+
expect(encontrarIndiceMayor([-5, -4, -3, -2, -1])).toBe(4);
9+
expect(encontrarIndiceMayor([-1, -3, -2, -5, -4])).toBe(0);
10+
});
11+
12+
test('devuelve 0 para un array vacío', () => {
13+
expect(encontrarIndiceMayor([])).toBe(0);
14+
});
15+
16+
test('devuelve 0 para un array con un solo elemento', () => {
17+
expect(encontrarIndiceMayor([42])).toBe(0);
18+
});

0 commit comments

Comments
 (0)