When I run the following code, half of the items are removed from the list.. I am trying to remove all items from the list.
//Sets an event listener to the reset button.
resetButton.addEventListener('click', (e) => {
const ul = document.getElementById("myUL");
console.log(ul.children.length);
//Moves through the unordered list and removes each list item.
for(let i = 0; i < ul.children.length; i++) {
ul.removeChild(ul.children[i]);
}
});