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);
3.83
6
Array.from(nodelist);
Thank you!
6
0
3.9
10
Array.prototype.slice.call(document.childNodes);
Thank you!
10
0
3
2
//spread the nodelist into an array
[...nodelist];
Thank you!
2
0
Are there any code examples left?
New code examples in category Other