From 260df5a579dffea81f06fb8278ea8414bc57f2e8 Mon Sep 17 00:00:00 2001 From: Sergio Madera De Marco <37299705@terciariourquiza.edu.ar> Date: Tue, 28 Apr 2026 19:29:55 -0300 Subject: [PATCH 1/5] puntos 2-4: condicionales y while de multiplos de 3 --- .vscode/launch.json | 14 ++++++++++++++ ejercicios.js | 28 +++++++++++++++++++++++++++- index.html | 1 + 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..e42bf51 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + // Use IntelliSense para saber los atributos posibles. + // Mantenga el puntero para ver las descripciones de los existentes atributos. + // Para más información, visite: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "chrome", + "request": "launch", + "name": "Open index.html", + "file": "c:\\Users\\chech\\javascript-primeros-ejercicios\\index.html" + } + ] +} \ No newline at end of file diff --git a/ejercicios.js b/ejercicios.js index 8e69ac3..3ee0fca 100644 --- a/ejercicios.js +++ b/ejercicios.js @@ -2,4 +2,30 @@ // siguiente en la consola (con F12): console.log("Archivo vinculado exitosamente"); -// Resolver acá los ejercicios propuestos. +// Punto 2 +let nombre = "Sergio"; +let edad = 33; + +if (edad >= 18) { + console.log(nombre + " es mayor de edad"); +} else { + console.log(nombre + " es menor de edad"); +} +// Punto 3 +if (edad < 13) { + console.log(nombre + " está en la infancia"); +} else if (edad >= 13 && edad <= 17) { + console.log(nombre + " está en la adolescencia"); +} else { + console.log(nombre + " es adulto"); +} +// Punto 4 +let maximo = 15; +let numero = 1; + +while (numero < maximo) { + if (numero % 3 === 0) { + console.log(numero); + } + numero++; +} \ No newline at end of file diff --git a/index.html b/index.html index b1c7d4f..c766e14 100644 --- a/index.html +++ b/index.html @@ -12,4 +12,5 @@ + -- 2.49.1 From e06df41999739e686d423a528bedad1fa43c95a9 Mon Sep 17 00:00:00 2001 From: Sergio Madera De Marco <37299705@terciariourquiza.edu.ar> Date: Tue, 28 Apr 2026 19:40:54 -0300 Subject: [PATCH 2/5] punto 5: multiplos de 3 con for --- ejercicios.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ejercicios.js b/ejercicios.js index 3ee0fca..179f1b4 100644 --- a/ejercicios.js +++ b/ejercicios.js @@ -28,4 +28,12 @@ while (numero < maximo) { console.log(numero); } numero++; +} +// Punto 5 +let maximo2 = 15; + +for (let i = 1; i < maximo2; i++) { + if (i % 3 === 0) { + console.log(i); + } } \ No newline at end of file -- 2.49.1 From a1582f7e172f793122a36c68e5bc4633c66695c7 Mon Sep 17 00:00:00 2001 From: Sergio Madera De Marco <37299705@terciariourquiza.edu.ar> Date: Tue, 28 Apr 2026 19:45:22 -0300 Subject: [PATCH 3/5] punto 6: array de frutas con for of --- ejercicios.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ejercicios.js b/ejercicios.js index 179f1b4..568c239 100644 --- a/ejercicios.js +++ b/ejercicios.js @@ -36,4 +36,10 @@ for (let i = 1; i < maximo2; i++) { if (i % 3 === 0) { console.log(i); } +} +// Punto 6 +const frutas = ["manzana", "banana", "pera"]; + +for (let fruta of frutas) { + console.log(fruta); } \ No newline at end of file -- 2.49.1 From a79be06eadd12024a250f0d183b679e8d7548607 Mon Sep 17 00:00:00 2001 From: Sergio Madera De Marco <37299705@terciariourquiza.edu.ar> Date: Tue, 28 Apr 2026 19:56:16 -0300 Subject: [PATCH 4/5] punto 7: funcion presentarse con parametros --- ejercicios.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ejercicios.js b/ejercicios.js index 568c239..81c6d27 100644 --- a/ejercicios.js +++ b/ejercicios.js @@ -42,4 +42,10 @@ const frutas = ["manzana", "banana", "pera"]; for (let fruta of frutas) { console.log(fruta); -} \ No newline at end of file +} +// Punto 7 +function presentarse(nombre, edad) { + return "Me llamo " + nombre + " y tengo " + edad + " años."; +} + +console.log(presentarse("Sergio", 33)); \ No newline at end of file -- 2.49.1 From a2e1647c886d3b208c76322e5573a92e0ee3b3af Mon Sep 17 00:00:00 2001 From: Sergio Madera De Marco <37299705@terciariourquiza.edu.ar> Date: Tue, 28 Apr 2026 19:59:55 -0300 Subject: [PATCH 5/5] punto 8: funcion para maximo minimo y promedio con array --- ejercicios.js | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/ejercicios.js b/ejercicios.js index 81c6d27..d17b4f0 100644 --- a/ejercicios.js +++ b/ejercicios.js @@ -48,4 +48,48 @@ function presentarse(nombre, edad) { return "Me llamo " + nombre + " y tengo " + edad + " años."; } -console.log(presentarse("Sergio", 33)); \ No newline at end of file +console.log(presentarse("Sergio", 33)); +// Punto 8 +const numeros = [1, 3, 8, 2, 18, 6]; + +// máximo +function obtenerMaximo(arr) { + let max = arr[0]; + + for (let num of arr) { + if (num > max) { + max = num; + } + } + + return max; +} + +// mínimo +function obtenerMinimo(arr) { + let min = arr[0]; + + for (let num of arr) { + if (num < min) { + min = num; + } + } + + return min; +} + +// promedio +function obtenerPromedio(arr) { + let suma = 0; + + for (let num of arr) { + suma += num; + } + + return suma / arr.length; +} + +// mostrar resultados +console.log("Máximo:", obtenerMaximo(numeros)); +console.log("Mínimo:", obtenerMinimo(numeros)); +console.log("Promedio:", obtenerPromedio(numeros)); \ No newline at end of file -- 2.49.1