What is the difference between referencing an object with object.key = value
and object['key'] = value
For example if I had an object call var myObj = {};
Asked
Active
Viewed 32 times
0

H. Lee
- 67
- 1
- 9
1 Answers
0
I believe the quote notation allows for arbitrary keys, (like console.log({' 1a':3}[' 1a'])
, whereas the dot syntax can only be used with keys that begin with a letter.

גלעד ברקן
- 23,602
- 3
- 25
- 61
-
How were you able to answer this *correctly* closed question, moreover with something that just looks like a comment ? http://stackoverflow.com/posts/40955994/timeline – Kaiido Dec 04 '16 at 06:23
-
@Kaiido I have no idea :) – גלעד ברקן Dec 04 '16 at 06:25