From 0df771ec8e4713af8c96fe95ae3a35a239302639 Mon Sep 17 00:00:00 2001 From: Sergio Madera De Marco <37299705@terciariourquiza.edu.ar> Date: Sat, 16 May 2026 16:17:22 -0300 Subject: [PATCH] ejercicio 4: destacar parrafos importantes con classList --- ejercicios-clase-8.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ejercicios-clase-8.js b/ejercicios-clase-8.js index 4c09eef..0c173e8 100644 --- a/ejercicios-clase-8.js +++ b/ejercicios-clase-8.js @@ -27,4 +27,15 @@ function agregarItem(texto) { nuevoItem.textContent = texto; lista.appendChild(nuevoItem); +} +// 4 + +function destacarParrafos() { + const parrafos = document.querySelectorAll("#parrafos p"); + + for (const parrafo of parrafos) { + if (parrafo.textContent.includes("importante")) { + parrafo.classList.add("destacado"); + } + } } \ No newline at end of file