a place to learn javascript for today's world.

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 (...) : let myArray = [...nodeList]