1) A nodeList is an object – an indexed (ordered) list of nodes. It has a length
property that returns the number of nodes in the list, and a method of item()
that returns the node at a specified index.
There's also an HTMLCollection
2) It is kind of like an array. You can use a for loop, but you can't use array methods on them or HTMLCollections because they do not inherit from the array object.
3) That's one's tricky. You essentially use slice
, but it fails in IE9… Here's an article that explains it in detail: duruk.net/nodelists-and-arrays-in-javascript/
One more thing to consider: nodeLists and HTMLCollections are live collections, meaning that they reflect updates to them in the DOM in real time, with the exception of when it is returned by .querySelectorAll.