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