create array from htmlcollection
snippet in javascript

create array from htmlcollection

user8400

//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().

html collection of elements to array

user7484

var boxes = Array.prototype.slice.call(document.getElementsByClassName('box'));

var boxes = [].slice.call(document.getElementsByClassName('box'));