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

@@ -60,3 +60,12 @@ const newSection = () => {
}); });
div.appendChild(list); div.appendChild(list);
} }
// Ejercicio 6
const cleanList = (id) => {
const list = document.getElementById(id);
while (list.firstChild) {
list.removeChild(list.firstChild);
}
}