In JavaScript, what is the best way to convert a NodeList to an array?

With ES6 you can simply do:

const spanList = [...document.querySelectorAll("span")];

Leave a Comment