JavaScript Weirdness
I was just listening to the lightning talk by Gary Bernhardt from CodeMash 2012 and he brought up some really interesting (and funny) points about JavaScript.
For example:
[] + [];
””
{} + {};
NaN
[] + {};
[object Object]
{} + [];
0
So why is it that if you add two empty Arrays you get an empty string, but if you add two objects you get “not a number”. Array + Object is an Object but Object plus Array is 0???