diff --git a/ejercicios-clase-8.js b/ejercicios-clase-8.js index 08c3f91..e1834b2 100644 --- a/ejercicios-clase-8.js +++ b/ejercicios-clase-8.js @@ -83,7 +83,36 @@ function limpiarLista(idDeLaLista){ const imagen = document.querySelector("img"); -console.log(imagen.getAttribute("src")); imagen.setAttribute("src", "foto2.jpg"); imagen.setAttribute("alt", "Locro"); -console.log(imagen.getAttribute("alt")); \ No newline at end of file + +//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); + } +} \ No newline at end of file