In JavaScript, what is the best way to convert a NodeList to an array? December 22, 2022 by Tarik With ES6 you can simply do: const spanList = [...document.querySelectorAll("span")];