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 @@ +