1var list = document.getElementsByClassName("events");
2for (let item of list) {
3 console.log(item.id);
4}
5
6
7// To include older browsers (including things like IE), this will work everywhere:
8var list= document.getElementsByClassName("events");
9for (var i = 0; i < list.length; i++) {
10 console.log(list[i].id); //second console output
11}