From 83911ea0e56f3f68e908d4152870e4812936e1af Mon Sep 17 00:00:00 2001 From: Alexis08041992 Date: Thu, 30 Apr 2026 17:43:52 -0300 Subject: [PATCH] Realizados hasta el principio del ejercicio 8 --- ejercicios.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/ejercicios.js b/ejercicios.js index 2c6fcd8..8f4e8a8 100644 --- a/ejercicios.js +++ b/ejercicios.js @@ -36,4 +36,26 @@ console.log("Ejercicio 6: Array de frutas"); const frutas = ["manzana", "banana", "mandarina"]; for (const fruta of frutas) { console.log(fruta); -} \ No newline at end of file +} + +console.log("Ejercicio 7: Funcion saludar"); + +function presentarse(nomre, edad) { + return `Hola, me llamo ${nombre} Tego ${edad} aƱos.`; +} +console.log(presentarse(nombre, edad)); + + +console.log("Ejercicio 8: Funcion arrays"); +const numeros = [ 1, 3, 8, 2, 18, 6 ]; + +function numeroMaximo(numeros) { + let max = numeros[0]; + for (let i = 1; i < numeros.length; i++) { + if (numeros[i] > max) { + max = numeros[i]; + } + } + return max; +} +console.log(numeroMaximo(numeros)); \ No newline at end of file