Accessing a number using the array operator e.g. 1[0] returns undefined #325
Unanswered
cmdcolin
asked this question in
WTF Questions
Replies: 1 comment 2 replies
-
Numbers are objects of class Number. Objects can have properties, and you can access them with [] |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I stumbled on this one today. we had some type confusion and i was accessing a number with a array operator. I am not sure why this returns undefined though! some sort of coercion occurs maybe? but then why do we get undefined at the end?
Beta Was this translation helpful? Give feedback.
All reactions