From 0f5e6cd31dc3ca8b4c153591fac4819b11467a90 Mon Sep 17 00:00:00 2001 From: Eugenio Zapata <37448644@terciariourquiza.edu.ar> Date: Mon, 25 May 2026 15:11:20 -0300 Subject: [PATCH] ejercicio 4 --- ejercicios-clase-8.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/ejercicios-clase-8.js b/ejercicios-clase-8.js index fbdc9e1..0426207 100644 --- a/ejercicios-clase-8.js +++ b/ejercicios-clase-8.js @@ -1,10 +1,15 @@ // Vincular este archivo al archivo index.html, y resolver aquĆ­ los ejercicios. + +// ejercicio 1 + console.log("El archivo esta vinculado correctamente.") const parrafo = document.querySelector("h1"); console.log(parrafo.textContent); parrafo.textContent = "Hola a todos!"; +/* ejercicio 2 */ + function agregarLista() { const items = document.querySelectorAll(".lista-comidas"); for (const item of items) { @@ -12,6 +17,8 @@ function agregarLista() { } } +/* ejercicio 3 */ + const lista = document.querySelector("ul"); function agregarItem(){ @@ -19,4 +26,17 @@ const lista = document.querySelector("ul"); let itemAgregado = prompt("Ingresa un nuevo item"); nuevoItem.textContent = itemAgregado; lista.appendChild(nuevoItem); - } \ No newline at end of file + } + +//ejercicio 4 + +const contenedor = document.getElementById("parrafos"); + +if(contenedor){ + const oracion = contenedor.querySelectorAll("p"); + const parrafosImportantes = Array.from(oracion).filter(palabra => palabra.textContent.toLowerCase().includes("importante")); + + parrafosImportantes.forEach(parrafo => { + parrafo.classList.add("destacado"); + }); +}