primeros 2 hechos

This commit is contained in:
2026-05-07 23:04:55 -03:00
parent 8b7e397900
commit b9cdcf043e
3 changed files with 22 additions and 0 deletions

15
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
}
]
}

View File

@@ -8,6 +8,8 @@ console.log("Archivo vinculado correctamente.");
luego `map` para elevarlos al cuadrado.
*/
const numeros = [1, 2, 3, 4, 5, 6, 7, 8];
const resultados=numeros.filter(n => n % 2 === 0).map(n => n * 2);
// Resultado esperado: [4, 16, 36, 64]
@@ -24,6 +26,10 @@ const productos = [
{ nombre: "Mouse", precio: 600 },
{ nombre: "Auriculares", precio: 1200 }
];
const producto=productos.filter(u => u.precio> 1000);
const nombres=productos.map(u => u.nombres);
console.log(nombres);
// Resultado esperado: ["Teclado", "Mouse"]
// Pista: se puede resolver encadenando `filter` y `map`.

View File

@@ -12,4 +12,5 @@
</body>
<script src="ejercicios.js"></script>
</html>