Why are there so many array-like objects in the DOM?

Tweet by Leon Arnott:

#TIL the reason the DOM has so many "array-like objects" that aren't functional arrays… is because in Javascript 1.0, there were no arrays.




Explanation:


  • ECMAScript 1 does have arrays, but it corresponds to JavaScript 1.3.
    JavaScript version numbers apply to the JavaScript engines implemented by Netscape/Mozilla. The cross-engine way of referring to the capabilities of the language are thus ECMAScript versions.

  • Arrays were indeed added after JavaScript 1, as this page shows, which lists the additions for version 1.1.



More information on array-like objects and arrays:

Comments

Popular posts from this blog

Steve Lopez and the Importance of Newspapers

Ideas for fixing unconnected computing

Omar to kill me