Collection HTML d'éléments à tableau
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().
const boxArray = [...document.getElementsByClassName('box')];
var boxes = Array.prototype.slice.call(document.getElementsByClassName('box'));
var boxes = [].slice.call(document.getElementsByClassName('box'));
var arr = Array.from(htmlCollection);
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<script>
const boxes = document.getElementsByClassName('box');
</script>