If you're looking to transform your HTML collection into an array, one way to achieve this is by utilizing the Array.from()
method.
However, if your primary objective in converting the collection to an array is for easy element access based on index or position, the code snippet below demonstrates that it's possible to do so using the HTML collection itself (although it involves treating keys as opposed to traditional indices).
function BoxAppearence() {
var BoxCollection = document.getElementsByClassName("Box");
var BoxArray = Array.from(BoxCollection);
console.log("### BoxCollection ###");
console.log("Is 'BoxCollection' an array?", Array.isArray(BoxCollection));
console.log(BoxCollection);
console.log(BoxCollection[12])
console.log('\n\n');
console.log("### BoxArray ###");
console.log("Is 'BoxArray' an array?", Array.isArray(BoxArray));
console.log(BoxArray);
console.log(BoxArray[12]);
}
BoxAppearence();
<div class="Box">box1</div>
<div class="Box">box2</div>
<div class="Box">box3</div>
<div class="Box">box4</div>
<div class="Box">box5</div>
<div class="Box">box6</div>
<div class="Box">box7</div>
<div class="Box">box8</div>
<div class="Box">box9</div>
<div class="Box">box10</div>
<div class="Box">box11</div>
<div class="Box">box12</div>
<div class="Box">box13</div>