NodeLists
Working with NodeLists
In my daily working with NodeLists I find I normally just want to convert them into arrays so mainly I just use the ES6 spread operator (see below) to convert it into something I can use.
-
Using Array.from():
Array.from(mySelection).forEach(doSomethingWithEachElement) -
Using the ES6 spread operator (…) :i guess this may not work in some browsers? still testing to confirm.let myArray = [...nodeList]
Next Article: Event Listeners