array from nodelist code example
Example 1: js convert nodelist to array
// Get all buttons as a NodeList
var btns = document.querySelectorAll('button');
// Convert buttons NodeList to an array
var btnsArr = Array.from(btns);
Example 2: nodelist to array
Array.from(nodelist);
Example 3: javascript querySelectorAll to array
const spanList = [...document.querySelectorAll("span")];
Example 4: nodelist to array
//spread the nodelist into an array
[...nodelist];