62 lines
1.9 KiB
JavaScript
62 lines
1.9 KiB
JavaScript
// Vincular este archivo al archivo index.html, y resolver aquí los ejercicios.
|
|
|
|
// Ejercicio 1
|
|
|
|
const changeTittle = (a) => {
|
|
const tittle = document.querySelector('h1');
|
|
tittle.textContent = a;
|
|
}
|
|
|
|
// Ejercicio 2
|
|
|
|
const addClass = (a) => {
|
|
const list = document.querySelectorAll('li');
|
|
list.forEach((item) => {
|
|
item.classList.add(a);
|
|
});
|
|
}
|
|
|
|
// Ejercicio 3
|
|
|
|
const addItem = (a) => {
|
|
const list = document.querySelector('ul');
|
|
const newItem = document.createElement('li');
|
|
newItem.textContent = a;
|
|
list.appendChild(newItem);
|
|
}
|
|
|
|
// Ejercicio 4
|
|
|
|
const highlight = () => {
|
|
const paragraphs = document.querySelectorAll('#parrafos p');
|
|
paragraphs.forEach((p) => {
|
|
if (p.textContent.toLowerCase().includes('importante')) {
|
|
p.classList.add('destacado');
|
|
}
|
|
});
|
|
}
|
|
|
|
// Ejercicio 5
|
|
|
|
const newSection = () => {
|
|
const body = document.querySelector('body');
|
|
const div = document.createElement('div');
|
|
body.appendChild(div);
|
|
|
|
const h2 = document.createElement('h2');
|
|
h2.textContent = 'Comidas tipidas del Litoral';
|
|
div.appendChild(h2);
|
|
|
|
const parragraph = document.createElement('p');
|
|
parragraph.textContent = 'El litoral argentino es conocido por su rica gastronomía, que incluye platos típicos como el surubí a la parrilla, el pacú al horno, la boga frita y el chivito al plato. Estos platos reflejan la diversidad de ingredientes y sabores que se encuentran en la región, y son una parte importante de la cultura culinaria del litoral.';
|
|
div.appendChild(parragraph);
|
|
|
|
const list = document.createElement('ul');
|
|
const items = ['Surubí a la parrilla', 'Pacú al horno', 'Boga frita', 'Chivito al plato'];
|
|
items.forEach((item) => {
|
|
const li = document.createElement('li');
|
|
li.textContent = item;
|
|
list.appendChild(li);
|
|
});
|
|
div.appendChild(list);
|
|
} |