From 0532b1ada84eabefe8d8e7acebf2810460898d50 Mon Sep 17 00:00:00 2001 From: Facundo Saucedo <43495919@terciariourquiza.edu.ar> Date: Tue, 28 Apr 2026 14:58:30 -0300 Subject: [PATCH 1/9] feat: link ejercicios.js to index.html --- ejercicios.js | 11 ++++++++++- index.html | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ejercicios.js b/ejercicios.js index 8e69ac3..e993c83 100644 --- a/ejercicios.js +++ b/ejercicios.js @@ -2,4 +2,13 @@ // siguiente en la consola (con F12): console.log("Archivo vinculado exitosamente"); -// Resolver acá los ejercicios propuestos. +// Primer ejercicio: + +const name = "Facundo"; +const age = 25; + +if (age >= 18) { + console.log(name + " es mayor de edad"); +} else { + console.log(name + " es menor de edad"); +} 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 1afc9c8d13e3c67b0c5bff4f7ce54b041f5e7b32 Mon Sep 17 00:00:00 2001 From: Facundo Saucedo <43495919@terciariourquiza.edu.ar> Date: Tue, 28 Apr 2026 15:06:23 -0300 Subject: [PATCH 2/9] feat: add age check with conditional logging --- ejercicios.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ejercicios.js b/ejercicios.js index e993c83..1683b3d 100644 --- a/ejercicios.js +++ b/ejercicios.js @@ -12,3 +12,5 @@ if (age >= 18) { } else { console.log(name + " es menor de edad"); } + +// Segundo ejercicio: \ No newline at end of file -- 2.49.1 From 8c7d3dfd4be368b37d1afe6b09cf97ab342f951d Mon Sep 17 00:00:00 2001 From: Facundo Saucedo <43495919@terciariourquiza.edu.ar> Date: Tue, 28 Apr 2026 15:17:51 -0300 Subject: [PATCH 3/9] feat: classify age into chilhood, teen and adult --- ejercicios.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ejercicios.js b/ejercicios.js index 1683b3d..4379907 100644 --- a/ejercicios.js +++ b/ejercicios.js @@ -13,4 +13,12 @@ if (age >= 18) { console.log(name + " es menor de edad"); } -// Segundo ejercicio: \ No newline at end of file +// Segundo ejercicio: + +if (age >= 18) { + console.log(name + " es un adulto"); +} else if (age >= 13) { + console.log(name + " es un adolescente"); +} else { + console.log(name + " es un infante"); +} -- 2.49.1 From 9ded62963726f251fbb145fc84f5ad453bfe5992 Mon Sep 17 00:00:00 2001 From: Facundo Saucedo <43495919@terciariourquiza.edu.ar> Date: Tue, 28 Apr 2026 15:36:19 -0300 Subject: [PATCH 4/9] feat: print multiples of 3 using while loop --- ejercicios.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ejercicios.js b/ejercicios.js index 4379907..81c1234 100644 --- a/ejercicios.js +++ b/ejercicios.js @@ -22,3 +22,15 @@ if (age >= 18) { } else { console.log(name + " es un infante"); } + +// Tercer ejercicio: + +const max = 20; +let n = 3; +const multiples = []; + +while (n < max) { + multiples.push(n); + n +=3; +} +console.log(`Múltiples de 3 menores que ${max}:`, multiples); \ No newline at end of file -- 2.49.1 From 60e4fe39bc11b0b59e7e3b2a6c93bd5620fe88bb Mon Sep 17 00:00:00 2001 From: Facundo Saucedo <43495919@terciariourquiza.edu.ar> Date: Tue, 28 Apr 2026 15:41:34 -0300 Subject: [PATCH 5/9] feat: print multiples of 3 using for loop --- ejercicios.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ejercicios.js b/ejercicios.js index 81c1234..4530ba2 100644 --- a/ejercicios.js +++ b/ejercicios.js @@ -33,4 +33,10 @@ while (n < max) { multiples.push(n); n +=3; } -console.log(`Múltiples de 3 menores que ${max}:`, multiples); \ No newline at end of file +console.log(`Múltiples de 3 menores que ${max}:`, multiples); + +// Cuarto ejercicio: + +for (let i = 3; i < max; i += 3) { + console.log(i); +} \ No newline at end of file -- 2.49.1 From 825e175687570d2fff133659ecb955b318eb22c8 Mon Sep 17 00:00:00 2001 From: Facundo Saucedo <43495919@terciariourquiza.edu.ar> Date: Tue, 28 Apr 2026 15:44:40 -0300 Subject: [PATCH 6/9] feat: iterate favorite fruits array with for...of --- ejercicios.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ejercicios.js b/ejercicios.js index 4530ba2..e8212e8 100644 --- a/ejercicios.js +++ b/ejercicios.js @@ -39,4 +39,12 @@ console.log(`Múltiples de 3 menores que ${max}:`, multiples); for (let i = 3; i < max; i += 3) { console.log(i); +} + +// Quinto ejercicio: + +const fruits = ["Manzana", "Banana", "Pera"] + +for (const fruit of fruits) { + console.log(fruit); } \ No newline at end of file -- 2.49.1 From 1358fb523b39d4eb576dda1a42a1aa482d83bcbf Mon Sep 17 00:00:00 2001 From: Facundo Saucedo <43495919@terciariourquiza.edu.ar> Date: Tue, 28 Apr 2026 15:52:43 -0300 Subject: [PATCH 7/9] feat: add presentarse function --- ejercicios.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ejercicios.js b/ejercicios.js index e8212e8..c2a121f 100644 --- a/ejercicios.js +++ b/ejercicios.js @@ -47,4 +47,9 @@ const fruits = ["Manzana", "Banana", "Pera"] for (const fruit of fruits) { console.log(fruit); -} \ No newline at end of file +} + +// Sexto ejercicio: + +const presentation = (a, b) => `Hola, mi nombre es ${a} y tengo ${b} años.`; +console.log(presentation(name, age)); \ No newline at end of file -- 2.49.1 From 59b1d96f5b3c05be5b559b46752e91a852368766 Mon Sep 17 00:00:00 2001 From: Facundo Saucedo <43495919@terciariourquiza.edu.ar> Date: Tue, 28 Apr 2026 16:14:05 -0300 Subject: [PATCH 8/9] feat: implement max, min and average functions using loops --- ejercicios.js | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/ejercicios.js b/ejercicios.js index c2a121f..4a80549 100644 --- a/ejercicios.js +++ b/ejercicios.js @@ -25,19 +25,19 @@ if (age >= 18) { // Tercer ejercicio: -const max = 20; +const maximum = 20; let n = 3; const multiples = []; -while (n < max) { +while (n < maximum) { multiples.push(n); n +=3; } -console.log(`Múltiples de 3 menores que ${max}:`, multiples); +console.log(`Múltiples de 3 menores que ${maximum}:`, multiples); // Cuarto ejercicio: -for (let i = 3; i < max; i += 3) { +for (let i = 3; i < maximum; i += 3) { console.log(i); } @@ -52,4 +52,39 @@ for (const fruit of fruits) { // Sexto ejercicio: const presentation = (a, b) => `Hola, mi nombre es ${a} y tengo ${b} años.`; -console.log(presentation(name, age)); \ No newline at end of file +console.log(presentation(name, age)); + +// Séptimo ejercicio: + +const numbers = [1, 3, 6, 12, 24, 5, 2, 9, 15]; + +const maxValue = (arr) => { + let max = arr[0]; + for (const num of arr) { + if (num > max) { + max = num; + } + } + return max; +}; +console.log(`El valor máximo es: ${maxValue(numbers)}`); + +const minValuer = (arr) => { + let min = arr[0]; + for (const num of arr) { + if (num < min) { + min = num; + } + } + return min; +} +console.log(`El valor mínimo es: ${minValuer(numbers)}`); + +const calculateAverage = (arr) => { + let sum = 0; + for (const num of arr) { + sum += num + } + return (sum / arr.length).toFixed(2); +} +console.log(`El promedio es: ${calculateAverage(numbers)}`); \ No newline at end of file -- 2.49.1 From 44b1d216a41a6a0724c410f12d1b89389edc423a Mon Sep 17 00:00:00 2001 From: Facundo Saucedo <43495919@terciariourquiza.edu.ar> Date: Tue, 28 Apr 2026 16:16:09 -0300 Subject: [PATCH 9/9] fix: correct function name for minValue in ejercicios.js --- ejercicios.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ejercicios.js b/ejercicios.js index 4a80549..713d024 100644 --- a/ejercicios.js +++ b/ejercicios.js @@ -69,7 +69,7 @@ const maxValue = (arr) => { }; console.log(`El valor máximo es: ${maxValue(numbers)}`); -const minValuer = (arr) => { +const minValue = (arr) => { let min = arr[0]; for (const num of arr) { if (num < min) { @@ -78,7 +78,7 @@ const minValuer = (arr) => { } return min; } -console.log(`El valor mínimo es: ${minValuer(numbers)}`); +console.log(`El valor mínimo es: ${minValue(numbers)}`); const calculateAverage = (arr) => { let sum = 0; -- 2.49.1