Ciaran said:
>
>On Mar 27, 2:55 am, "-Lost" <missed-s...@comcast.net> wrote:
>
>> var parents =3D {};
>> parents =3D {
>> 'daddy' : 'The Dad',
>> 'mommy' : 'The Mom'
>>
>> }
>
>Thanks a lot Lost, This explains a lot and is much clearer than the
>average posts on this topic. Is there a way to call the 'mommy' using
>an index by chance?
No, because parents['mommy'] is not actually an element of the array.
It is a new attribute that has been added to the Array object.
"square bracket" notation has two completely different meanings,
depending on whether the brackets contain an integer or a string.
They both look like they access array elements, but that's not
really what's going on:
parents[integer] sets or gets the array element at position integer
parents[string] sets or gets the object attribute named by string
--
|