To convert a NodeList to an array with JavaScript, we use the spread operator.
For instance, we write
const spanList = [...document.querySelectorAll("span")];
to select all spans and put them in a node list with querySelectorAll
.
And then we spread the node list entries into an array with the spread operator.