Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • How did you display the DOM in your 3rd response? Thanks! Commented Apr 2, 2013 at 12:19
  • @user1032531 that is the Chrome dev tools. By the way I updated the start of the answer. Commented Apr 2, 2013 at 12:22
  • The array-like log is mostly a result of the length property, not of the numeric property names. And what does your example of alerting a string have to do with console.log?
    – Bergi
    Commented Apr 2, 2013 at 12:31
  • That was showing how you can have numeric properties on objects. I'm trying to emphasis the facts that they're objects, not arrays. Commented Apr 2, 2013 at 12:34
  • Number 3 is completely wrong. getElementsByClassName and getElementsByTagName return HTMLCollections and NOT NodeLists. querySelector and querySelectorAll will return a NodeList.
    – SkyShab
    Commented Jan 21, 2021 at 13:40