The term array-like object refers to any object that doesn’t throw during the
length conversion process described above. In practice, such object is expected to actually have a
length property and to have indexed elements in the range
length - 1.
Array object, as with arrays in other programming languages, enables storing a collection of multiple items under a single variable name, and has members for performing common array operations.
0, the second is at index
1, and so on — and the last element is at the value of the array’s
length property minus
Array objects cannot use arbitrary strings as element indexes (as in an associative array) but must use nonnegative integers (or their respective string form). Setting or accessing via non-integers will not set or retrieve an element from the array list itself, but will set or access a variable associated with that array’s object property collection. The array’s object properties and list of array elements are separate, and the array’s traversal and mutation operations cannot be applied to these named properties.
Array elements are object properties in the same way that
toString is a property (to be specific, however,
toString() is a method). Nevertheless, trying to access an element of an array as follows throws a syntax error because the property name is not valid: