feat: add addItem function to append new items to the list

This commit is contained in:
2026-05-14 14:09:04 -03:00
parent 502b762b99
commit 215bc5e6d2

View File

@@ -14,4 +14,13 @@ const addClass = (a) => {
list.forEach((item) => { list.forEach((item) => {
item.classList.add(a); 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);
} }