From 3473a7186fb8d950fcf08ea101924140133d4a92 Mon Sep 17 00:00:00 2001 From: thaismota-tech Date: Sat, 25 Apr 2026 18:01:45 +0200 Subject: [PATCH 1/9] He finalizado el ejercicio 1 --- index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.js b/index.js index 419c9ff..7dfb047 100644 --- a/index.js +++ b/index.js @@ -1 +1,7 @@ //RESUELVE LOS EJERCICIOS AQUI +//EJERCICIO 1: +const numbers = [4, 5, 6, 7, 8, 9, 10]; +function elevados(numbers) { +return numbers.map(num => num ** num); +}; + From 6213b621f75d9c2fc466c9699f80c08bea90120e Mon Sep 17 00:00:00 2001 From: thaismota-tech Date: Sat, 25 Apr 2026 18:29:37 +0200 Subject: [PATCH 2/9] He finalizado el ejercicio 2 --- index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 7dfb047..33a7c6f 100644 --- a/index.js +++ b/index.js @@ -3,5 +3,18 @@ const numbers = [4, 5, 6, 7, 8, 9, 10]; function elevados(numbers) { return numbers.map(num => num ** num); -}; +} +//EJERCICIO 2: +const foodList = ['Pizza', 'Ramen', 'Paella', 'Entrecot']; +const result = foodList.map((food, index) => { + if (index === 0) { + return `Como soy de Italia, amo comer ${food}`; + } else if (index === 1) { + return `Como soy de Japón, amo comer ${food}`; + } else if (index === 2) { + return `Como soy de Valencia, amo comer ${food}`; + } else { + return `Aunque no como carne, el ${food} es sabroso`; + } +}); \ No newline at end of file From 48f2ef4f08bbbea85cef707a3abdd9d6d174b752 Mon Sep 17 00:00:00 2001 From: thaismota-tech Date: Sat, 25 Apr 2026 18:39:54 +0200 Subject: [PATCH 3/9] He finalizado el ejercicio 3 --- index.js | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 33a7c6f..522118c 100644 --- a/index.js +++ b/index.js @@ -7,7 +7,7 @@ return numbers.map(num => num ** num); //EJERCICIO 2: const foodList = ['Pizza', 'Ramen', 'Paella', 'Entrecot']; -const result = foodList.map((food, index) => { +const result2 = foodList.map((food, index) => { if (index === 0) { return `Como soy de Italia, amo comer ${food}`; } else if (index === 1) { @@ -17,4 +17,31 @@ const result = foodList.map((food, index) => { } else { return `Aunque no como carne, el ${food} es sabroso`; } -}); \ No newline at end of file +}); + +//EJERCICIO 3: +const staff = [ + { + name: 'Pepe', + role: 'The Boss', + hobbies: ['leer', 'ver pelis'] + }, + { + name: 'Ana', + role: 'becaria', + hobbies: ['nadar', 'bailar'] + }, + { + name: 'Luis', + role: 'programador', + hobbies: ['dormir', 'comprar'] + }, + { + name: 'Carlos', + role: 'secretario', + hobbies: ['futbol', 'queso'] + } +]; +const result3 = staff.map((persona) => { + return `${persona.name} es ${persona.role} y le gusta ${persona.hobbies[0]} y ${persona.hobbies[1]}`; +}); From a82d660d2d78dd9a8cda21053aff58752008ae30 Mon Sep 17 00:00:00 2001 From: thaismota-tech Date: Sat, 25 Apr 2026 23:42:44 +0200 Subject: [PATCH 4/9] He finalizado el ejercicio 4 --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index 522118c..1980fea 100644 --- a/index.js +++ b/index.js @@ -45,3 +45,7 @@ const staff = [ const result3 = staff.map((persona) => { return `${persona.name} es ${persona.role} y le gusta ${persona.hobbies[0]} y ${persona.hobbies[1]}`; }); + +//EJERCICIO 4: Crea un segundo array result4 a partir del array numbers2 que devuelva solo los impares +const numbers2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; +const result4 = numbers2.filter(num => num % 2 !== 0); \ No newline at end of file From 85af854ab80dd36b0d3a2ae435a883cd4addcedd Mon Sep 17 00:00:00 2001 From: thaismota-tech Date: Sun, 26 Apr 2026 00:12:59 +0200 Subject: [PATCH 5/9] He finalizado el ejercicio 5 --- index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 1980fea..197a0c3 100644 --- a/index.js +++ b/index.js @@ -48,4 +48,17 @@ const result3 = staff.map((persona) => { //EJERCICIO 4: Crea un segundo array result4 a partir del array numbers2 que devuelva solo los impares const numbers2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; -const result4 = numbers2.filter(num => num % 2 !== 0); \ No newline at end of file +const result4 = numbers2.filter(num => num % 2 !== 0); + +//EJERCICIO 5: Dado el array foodList2, genera un segundo array result5 que filtre los platos veganos y saque una sentencia como la del ejemplo +const foodList2 =[ +{name: 'Tempeh', isVeggie: true}, +{name: 'Cheesbacon burguer', isVeggie: false}, +{name: 'Entrecot',isVeggie: false}, +]; +const result5 =foodList2 + .filter(plato => plato.isVeggie === true) // 1. Filtramos: solo pasan los veganos + .map(plato => { +let adjetivo = plato.name.includes('burguer') ? 'rica' : 'rico'; +return `Que ${adjetivo} ${plato.name} me voy a comer!` +}); \ No newline at end of file From d99c48d722d65fc7ed1ee7d76e08d4a6d42c7783 Mon Sep 17 00:00:00 2001 From: thaismota-tech Date: Sun, 26 Apr 2026 00:23:09 +0200 Subject: [PATCH 6/9] He finalizado el ejercicio 6 --- index.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 197a0c3..d5d0065 100644 --- a/index.js +++ b/index.js @@ -61,4 +61,26 @@ const result5 =foodList2 .map(plato => { let adjetivo = plato.name.includes('burguer') ? 'rica' : 'rico'; return `Que ${adjetivo} ${plato.name} me voy a comer!` -}); \ No newline at end of file +}); + +//EJERCICIO 6: Dado el array inventory, devolver un array con los nombres de los elementos que valgan más de 300 euros. +const inventory = [ + { + name: 'Mobile phone', + price: 199 + }, + { + name: 'TV Samsung', + price: 459 + }, + { + name: 'Viaje a Cancún', + price: 600 + }, + { + name: 'Mascarilla', + price: 1 + } +]; +const result6 = inventory + .filter(articulo => articulo.price > 300).map(articulo => articulo.name); From 9bf4a2d83207ced0a5fb8cb4bb77ce8d57274e89 Mon Sep 17 00:00:00 2001 From: thaismota-tech Date: Sun, 26 Apr 2026 00:30:32 +0200 Subject: [PATCH 7/9] He finalizado el ejercicio 7 --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index d5d0065..32e2f8f 100644 --- a/index.js +++ b/index.js @@ -84,3 +84,7 @@ const inventory = [ ]; const result6 = inventory .filter(articulo => articulo.price > 300).map(articulo => articulo.name); + + //EJERCICIO 7: Dado el siguiente array numeros [39, 2, 4, 25, 62], obten la multiplicación de todos los elementos del array + const numbers3 = [39, 2, 4, 25, 62] +const result7 = numbers3.reduce((acc, num) => acc * num, 1); \ No newline at end of file From 4d04a4d8fe542ed9c13e476a985a3bcb97fb9f3d Mon Sep 17 00:00:00 2001 From: thaismota-tech Date: Sun, 26 Apr 2026 00:47:41 +0200 Subject: [PATCH 8/9] He finalizado el ejercicio 8 --- index.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 32e2f8f..5795926 100644 --- a/index.js +++ b/index.js @@ -87,4 +87,22 @@ const result6 = inventory //EJERCICIO 7: Dado el siguiente array numeros [39, 2, 4, 25, 62], obten la multiplicación de todos los elementos del array const numbers3 = [39, 2, 4, 25, 62] -const result7 = numbers3.reduce((acc, num) => acc * num, 1); \ No newline at end of file +const result7 = numbers3.reduce((acc, num) => acc * num, 1); + + + //EJERCICIO 8: Concatena todos los elementos del array con reduce para que devuelva una sola frase +const sentenceElements = [ + 'Me', + 'llamo', + 'Thaís', + 'y', + 'quiero', + 'sentir', + 'la', + 'fuerza', + 'con', + 'javascript' +]; +const result8 = sentenceElements.reduce((acc, name) => { + return `${acc} ${name}`; +}); \ No newline at end of file From 1344119186381681a01a447221cb10aa555c8d19 Mon Sep 17 00:00:00 2001 From: thaismota-tech Date: Sun, 26 Apr 2026 01:02:24 +0200 Subject: [PATCH 9/9] He finalizado el ejercicio 9 --- index.js | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 5795926..ede6587 100644 --- a/index.js +++ b/index.js @@ -105,4 +105,36 @@ const sentenceElements = [ ]; const result8 = sentenceElements.reduce((acc, name) => { return `${acc} ${name}`; -}); \ No newline at end of file +}); + + +//EJERCICIO 9: Obtener el monto total de los elementos que pertenecen a catergory "code" en el siguiente array. +const books = [ + { + name: ' JS for dummies', + author: 'Emily A. Vander Veer', + price: 20, + category: 'code' + }, + { + name: 'Don Quijote de la Mancha', + author: 'Cervantes', + price: 14, + category: 'novel' + }, + { + name: 'Juego de tronos', + author: 'George R. Martin', + price: 32, + category: 'Fantasy' + }, + { + name: 'javascript the good parts', + author: 'Douglas Crockford', + price: 40, + category: 'code' + } +]; +const result9 = books + .filter(book => book.category === 'code') + .reduce((acc, book) => acc + book.price, 0);