I have a for loop in JS that for whatever reason doesn't iterate fully over the array.
var selectedElements = document.getElementsByClassName("selected");
console.log(selectedElements.length); //outputs 7
for(i = 0; i < selectedElements.length; i++){
console.log(i); //outputs 0, 1, 2, 3
selectedElements[i].classList.remove("selected");
}
The length of selectedElements is 7 yet for whatever reason the for loop only does 4 passes. I'm at a loss please help