Why does {a:1}['a'] equals ['a'] and console.log( {a:1}['a'] ) equals 1? I tried in node 13.8 and chrome.
Asked
Active
Viewed 66 times
0
-
`{a:1}['a']` equals `['a']`. What do you mean by this? – Maheer Ali Feb 16 '20 at 18:33
-
@MaheerAli He means that when you enter the statement `{a:1}['a']` in the devtools console, you get back an array. – Bergi Feb 16 '20 at 18:34
-
@Bergi You are right. I just don't understand this behavior. – Hank Wang Feb 16 '20 at 18:44
-
@HankWang The second duplicate link should have the most insight for your case – Bergi Feb 16 '20 at 18:48