From b0b66c62197f5f8d2a52950f507377381a293ac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Blas=20Alarc=C3=B3n?= <47840816@terciariourquiza.edu.ar> Date: Thu, 21 May 2026 18:29:04 -0300 Subject: [PATCH] Cree la funcion construirLista --- ejercicios-clase-8.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/ejercicios-clase-8.js b/ejercicios-clase-8.js index 5cc4920..1c0320f 100644 --- a/ejercicios-clase-8.js +++ b/ejercicios-clase-8.js @@ -74,4 +74,26 @@ function limpiarLista(idLista) { const foto = document.querySelector("#foto"); foto.src = "foto2.jpg"; -foto.alt = "Locro"; \ No newline at end of file +foto.alt = "Locro"; + +function construirLista(array) { + + const nuevoDiv2 = document.createElement("div") + nuevoDiv2.classList.add("grupo-comidas"); + + const titulo2 = document.createElement("h2"); + titulo2.textContent = array[0]; + + const ul2 = document.createElement("ul") + + for (let i = 1; i < array.length; i++) { + const li = document.createElement("li"); + li.textContent = array[i]; + ul2.appendChild(li); + } + + nuevoDiv2.appendChild(titulo2); + nuevoDiv2.appendChild(ul2); + + return nuevoDiv2; +} \ No newline at end of file