From a language design perspective, if Javascript objects are simply associative arrays, then why ha
- by Christopher Altman
I was reading about objects in O'Reilly Javascript Pocket Reference and the book made the following statement.
An object is a compound data type that contains any number of properties.
Javascript objects are associative arrays: they associate arbitrary data values with arbitrary names.
From a language design perspective, if objects are simply associative arrays, then why have objects?
I appreciate the convenience of having objects in the language, but if convenience is the main purpose for adding a data type, then how do you decide what to add and what to not add in a language? A language can quickly become bloated and less valuable if it is weighed down by several overlapping methods and data types (Is this a true statement or am I missing something).