1//Use the Array.from() method to convert a nodelist or HTMLcollection into an array.
2
3let elements = document.getElementsByClassName("classnameHere");
4let arrayOfElements = Array.from(elements);
5
6//Now arrayOfElements is iterable with methods such as .forEach().
1<div class="box"></div>
2<div class="box"></div>
3<div class="box"></div>
4<div class="box"></div>
5
6<script>
7 const boxes = document.getElementsByClassName('box');
8</script>