Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript and the DOM Getting a Handle on the DOM Use CSS Queries to Select Page Elements

how do you spot an HTML Collection?

Is it only when we see " collection[name] " ?

because everything we've been using are " getElementsByTagName " / " querySelector ", etc. Are these node list?

Im a little confused

1 Answer

Steven Parker
Steven Parker
229,644 Points

An HTMLCollection differs from a NodeList primarily in that it is "live", meaning that its contents will be automatically updated whenever the associated parts of the DOM are changed.

On the other hand, a NodeList is typically a static "snapshot" of how things were at the time it is created (though there are some "live" exceptions). A NodeList also has some additional methods not available on an HTMLCollection.

For more details, see these MDN pages on HTMLCollection and NodeList.