So i wrote a fairly simple function to remove the "hidden" class from 3 items, when another element is clicked. Onclick it gets the 3 items right but it only changes item1+3 and item2 needs another click. I have absolutly no clue why this is happening.
https://codepen.io/zafire/pen/ExexWre
function lmao() {
  const collection = document.getElementsByClassName("hidden");
  console.log(collection.length);
  for (var i = 0; i < collection.length; i++) {
    collection[i].classList.remove("hidden");
  }
}body {
  text-align: center;
  font-size: 27px;
}
.hidden {
  display: none;
}
.nothidden {
  display: block;
}<div>
  <span onclick="lmao()">arrow</span>
  <br><br><br>
  <span class="hidden">item1</span>
  <br>
  <span class="hidden">item2</span>
  <br>
  <span class="hidden">item3</span>
  <br>
</div>Also i would like to notice solved this now differently but im still curious why this particular code does not work.
 
    