ejercicio 8

This commit is contained in:
2026-05-25 21:07:50 -03:00
parent 1bb1058df3
commit e1dcf6db72

View File

@@ -83,7 +83,36 @@ function limpiarLista(idDeLaLista){
const imagen = document.querySelector("img"); const imagen = document.querySelector("img");
console.log(imagen.getAttribute("src"));
imagen.setAttribute("src", "foto2.jpg"); imagen.setAttribute("src", "foto2.jpg");
imagen.setAttribute("alt", "Locro"); imagen.setAttribute("alt", "Locro");
console.log(imagen.getAttribute("alt"));
//ejercicio 8
const construirLista1 = (["Comidas mendocinas", "Sopaipilla", "Vino tinto"]);
function construirLista(){
const listaComidaMendoza = Array.from(construirLista1).filter(palabra => palabra.length)
if(listaComidaMendoza.length > 0){
const div1 = document.createElement("div");
div1.classList.add("grupo-comidas");
const miH2 = document.createElement("h2");
miH2.textContent = listaComidaMendoza[0];
div1.appendChild(miH2);
const agregarUl = document.createElement("ul");
agregarUl.classList.add("Comidas-mendocinas");
const agregarLi = document.createElement("li");
agregarLi.textContent = listaComidaMendoza[1];
agregarUl.appendChild(agregarLi);
const agregarLi2 = document.createElement("li");
agregarLi2.textContent = listaComidaMendoza[2];
agregarUl.appendChild(agregarLi2);
div1.appendChild(agregarUl);
document.body.appendChild(div1);
}
}