Check out example codes for "html collection of elements to array". It will help you in understanding the concepts better.

Code Example 1

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

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

Code Example 2

const boxes = Array.from(document.getElementsByClassName('box'));

Code Example 3

const boxArray = [...document.getElementsByClassName('box')];

Code Example 4

<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>

<script>
    const boxes = document.getElementsByClassName('box');
</script>

Learn ReactJs, React Native from akashmittal.com