What is the purpose of calling Array.prototype.slice against a NodeList? [duplicate]
This question already has an answer here: Explanation of [].slice.call in javascript? 7 answers how does Array.prototype.slice.call() work? 13 answers Why doesn't nodelist have forEach? 10 answers I was looking up how to iterate NodeLists and I came across the following bit of code. var nodesArray = Array.prototype.slice.call(nodeList); nodesArray.forEach(function(node) { //... }) What is the purpose of calling Array.prototype.slice against a NodeList? What is the purpose of calling Array.prototype.slice against a NodeList? The Array#slice method "returns a shallow copy of a portion of an