Something strange when loop on HTMLCollections

Just jot down something strange. Given a HTMLCollections, for instance, some Elements hidden, like: ```javascript let hideElements = document.getElementsByClassName('hide'); ``` We will get a array-like HTMLCollections. Let try for loop on it: ```javasc
Article Tue, Sep 28, 2021

Just jot down something strange.

Given a HTMLCollections, for instance, some Elements hidden, like:

let hideElements = document.getElementsByClassName('hide');

We will get a array-like HTMLCollections. Let try for loop on it:

for (let ele of hideElements) {
  ele.classList.remove('hide');
}

The result via for-loop is : just part of elements are really get rid of class hide.

And it is better to convert to Array then call .forEach:

Array.from(hideElements).forEach(ele => ele.classList.remove('hide'));

Every element has no hide class now.