

Ask HN: Why does JavaScript use NodeList instead of Array? - dandare

This question is too speculative to ask on StackOverflow and indeed speculative answers is what I seek.<p>Why does JS use the concept of NodeLists and collection instead of simple arrays? The first thing everyone does with NodeList it to convert it to array. Sure, some NodeLists are &quot;live&quot;, but not all of them and I have never used this property. IMHO it&#x27;s an ugly paradigm that must be slowing down the DOM.
======
mxstbr
Quoted from a thread on StackOverflow: "Because the DOM is designed to not
depend on anything language specific. All types returned by the DOM API will
be host types rather than native types. This allows the DOM to be language
agnostic and not dependent on any specific language construct." [1]

[1] [https://stackoverflow.com/questions/21768551/javascript-
why-...](https://stackoverflow.com/questions/21768551/javascript-why-use-
nodelist-instead-of-using-array)

~~~
dandare
ty

