From 3b0d27b79f909806d265f21ef28007fab15d3cf4 Mon Sep 17 00:00:00 2001 From: Nicolas Murua Date: Wed, 13 May 2026 21:08:34 -0300 Subject: [PATCH] ejercicio 8 --- ejercicios-clase-8.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ejercicios-clase-8.js b/ejercicios-clase-8.js index aa66974..ee6fb1c 100644 --- a/ejercicios-clase-8.js +++ b/ejercicios-clase-8.js @@ -77,4 +77,29 @@ function cambiarFoto(foto, texto){ const imagen = document.querySelector("#foto"); imagen.setAttribute("src", foto); imagen.setAttribute("alt", texto); +} + +function construirLista(items){ + + const contenedor = document.createElement("div"); + + const titulo = document.createElement("h2"); + titulo.textContent = "Lista dinĂ¡mica"; + + const lista = document.createElement("ul"); + + for (const item of items){ + + const li = document.createElement("li"); + + li.textContent = item; + + lista.appendChild(li); + } + + contenedor.appendChild(titulo); + contenedor.appendChild(lista); + document.body.appendChild(contenedor); + contenedor.classList.add("grupo-comidas"); + return contenedor; } \ No newline at end of file