From eaafa701b62fc1241bfd372275c9d24c84048418 Mon Sep 17 00:00:00 2001 From: Geronimo Hidalgo <45217034@terciariourquiza.edu.ar> Date: Thu, 21 May 2026 01:12:42 -0300 Subject: [PATCH] cree un filter y un map para poder elevar los numeros pares al cuadrado --- ejercicios.js | 9 +++++++++ index.html | 1 + 2 files changed, 10 insertions(+) diff --git a/ejercicios.js b/ejercicios.js index c12f2d1..37b4696 100644 --- a/ejercicios.js +++ b/ejercicios.js @@ -8,6 +8,15 @@ console.log("Archivo vinculado correctamente."); luego `map` para elevarlos al cuadrado. */ const numeros = [1, 2, 3, 4, 5, 6, 7, 8]; + +function numerosPares(number){ + return (number % 2 === 0); +} + +const numPares = numeros.filter(numerosPares); +const numCuadrado = numPares.map(num => num ** 2); +console.log(numCuadrado) + // Resultado esperado: [4, 16, 36, 64] diff --git a/index.html b/index.html index b44ebd0..0f79a77 100644 --- a/index.html +++ b/index.html @@ -12,4 +12,5 @@ +