16 lines
389 B
JavaScript
16 lines
389 B
JavaScript
// Vincular este archivo al archivo index.html, y resolver aquí los ejercicios.
|
|
|
|
// Ejercicio 1
|
|
const changeText = (str) => {
|
|
const h1 = document.querySelector("h1");
|
|
h1.textContent = str;
|
|
}
|
|
|
|
// Ejercicio 2
|
|
const addClass = (className) => {
|
|
const itemLista = document.querySelectorAll("li");
|
|
itemLista.forEach((item) => {
|
|
item.classList.add(className);
|
|
});
|
|
}
|