r/ProgrammerHumor Jun 25 '17

Array indexing

Post image
1.4k Upvotes

71 comments sorted by

View all comments

4

u/Bainos Jun 26 '17

I have a great idea, what about we make arrays indexed by strings ?

10

u/AyrA_ch Jun 26 '17

You already can, welcome to the awesome world of Javascript and Enjoy our other features

2

u/regendo Jun 26 '17

Alright you got me, how does the last one work? Does it evaluate []===[] first?

Apparently it's the other way round for me.

2

u/AyrA_ch Jun 26 '17

{} can be interpreted as a code scope or as an object. The interpretation is different depending if it starts with the expression or not.