From 130e464ae5693e85c7b2677cda9e72ab48a2f0c5 Mon Sep 17 00:00:00 2001 From: Sergio Madera De Marco <37299705@terciariourquiza.edu.ar> Date: Sat, 16 May 2026 15:40:26 -0300 Subject: [PATCH] ejercicio 3: agregar elementos a una lista con createElement --- ejercicios-clase-8.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ejercicios-clase-8.js b/ejercicios-clase-8.js index 3234583..4c09eef 100644 --- a/ejercicios-clase-8.js +++ b/ejercicios-clase-8.js @@ -16,4 +16,15 @@ function destacarComidas() { for (const comida of comidas) { comida.style.color = "red"; } +} +// 3 + +function agregarItem(texto) { + const lista = document.querySelector("#lista-inicial"); + + const nuevoItem = document.createElement("li"); + + nuevoItem.textContent = texto; + + lista.appendChild(nuevoItem); } \ No newline at end of file