Преобразовать HTMLCollection в массив
const boxes = Array.from(document.getElementsByClassName('box'));
Lucky Locust
const boxes = Array.from(document.getElementsByClassName('box'));
//Use the Array.from() method to convert a nodelist or HTMLcollection into an array.
let elements = document.getElementsByClassName("classnameHere");
let arrayOfElements = Array.from(elements);
//Now arrayOfElements is iterable with methods such as .forEach().
Array.from(elements);
var boxes = Array.prototype.slice.call(document.getElementsByClassName('box'));
var boxes = [].slice.call(document.getElementsByClassName('box'));