From b50d8a2bb6f4afd48ec3cb96a0b78ae1b27f2da9 Mon Sep 17 00:00:00 2001 From: maximo hidalgo <47135001@gmail.com> Date: Mon, 18 May 2026 18:46:47 -0300 Subject: [PATCH] agregado funcion agregarItem --- ejercicios-clase-8.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ejercicios-clase-8.js b/ejercicios-clase-8.js index 236771a..7e60d00 100644 --- a/ejercicios-clase-8.js +++ b/ejercicios-clase-8.js @@ -12,4 +12,14 @@ for (const p of item) { console.log("Clase agregada a:", p); } } -//ejercicio 3 \ No newline at end of file +//ejercicio 3 +function agregarItem(texto){ + const lista = document.querySelector("ul"); + +const nuevoItem = document.createElement("li"); +nuevoItem.textContent = texto ; +nuevoItem.id= "lista-inicial"; +lista.appendChild(nuevoItem); +console.log("Clase agregada a:", nuevoItem) +} +//ejercicio 4 \ No newline at end of file