I am retrieving all the list elements from a menu in order to eliminate the ones that I do not want.
let prodMenu = document.getElementsByClassName("productMenu-category");
for (let i = 0; i < prodMenu.length; i++) {
if(i > 0 && prodMenu[i].innerHTML == prodMenu[i-1].innerHTML){prodMenu[i].style.display = "none";}
}
This is my current approach, however, instead of hiding them, I want to actually remove them. It seems like what I retrieve is referred to as a "collection" which does not support functions for removing its items. I cannot use methods like "delete prodMenu[i]" or "prodMenu.delete()" or even "prodMenu.splice()" because they are not applicable to a "collection."