Research Documentation 3 - HTMLCollection vs NodeList

Explaining the HTMLCollection

HTMLCollection is a live array that can only contain tags with class name or id name.

Explaining the NodeList

NodeList is also an array, but can contain all types of nodes, including whitespace and text, and are static but can be live if the elements are accessed using childNodes.

Differences and Similarities

HTMLCollection and NodeList both are arrays that can hold tags. NodeList can also include whitespace and text, while HTMLCollection can't.

Summary

HTMLCollection and NodeList are similar, but NodeList can hold more nodes, like whitespace and text that HTMLCollection can not. HTMLCollection is live and recognizes new elements when appended, and NodeList is static and will not recognize new elements unless childNodes is used.