Possible Duplicate:
Can anyone explain these bizarre Javascript behaviours mentioned in the 'Wat' talk for CodeMash 2012?
Someone I know gave me these examples as a reason why he can't consider javascript a proper programming language, or something along the line.
I was wondering if there are some reasons for these return values?
For the first one, I guess an explanation could be, that []==""
returns true? And therefore []+[]
is 'equivalent' to ""+""
? But if that's right, since []==0
returns true too, why is the empty string interpretation chosen over 0?