From 02470dcaa6734ff2660815366f3c881986a4e348 Mon Sep 17 00:00:00 2001 From: Geronimo Hidalgo <45217034@terciariourquiza.edu.ar> Date: Mon, 25 May 2026 18:26:09 -0300 Subject: [PATCH] Cree una funcion para construir listas --- ejercicios-clase-8.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ejercicios-clase-8.js b/ejercicios-clase-8.js index 5fc710d..f0c3315 100644 --- a/ejercicios-clase-8.js +++ b/ejercicios-clase-8.js @@ -71,4 +71,20 @@ const cambiarImg = () => { img.alt = "Locro"; } +// Ejercicio 8 +const construirlist = (array) => { + const div = document.createElement("div"); + div.classList.add("grupo-comidas"); + const h2 = document.createElement("h2"); + h2.textContent = array[0]; + const ul = document.createElement("ul"); + for (let i = 1; i < array.length; i++){ + const li = document.createElement("li"); + li.textContent = array[i]; + ul.appendChild(li); + }; + div.appendChild(ul); + return div; +} +