The `HTMLCollection` object has a method - `item()` which can be used to loop through the elements in the collection. The `item()` method returns the element located at the specified offset from the collection. Example:
const gridContainers = document.getElementsByClassName("grid-container");
for (let i = 0; i < gridContainers.length; i++) {
console.log(gridContainers.item(i));
}
The `HTMLCollection` has a method `item()` which returns the element located at the specified offset from the collection. You can loop through the elements in the `HTMLCollection` like this:
var list = document.getElementsByClassName("events");
for (let i = 0; i < list.length; i++) {
console.log(list.item(i));
console.log(list.item(i).id);
}