feat: add cleanList function to delete specified elements from the DOM

This commit is contained in:
2026-05-14 14:37:01 -03:00
parent 981b59b066
commit f80218541e

View File

@@ -59,4 +59,13 @@ const newSection = () => {
list.appendChild(li); list.appendChild(li);
}); });
div.appendChild(list); div.appendChild(list);
}
// Ejercicio 6
const cleanList = (id) => {
const list = document.getElementById(id);
while (list.firstChild) {
list.removeChild(list.firstChild);
}
} }