[] + {} is equal to [object Object], in Javascript? How? [closed]

wallart

New Member
\[quote\] Possible Duplicate:
What is the explanation for these bizarre JavaScript behaviours mentioned in the 'Wat' talk for CodeMash 2012? \[/quote\]I'm very new to JavaScript. I have a code like this :\[code\]<script type="text/javascript">console.log( [] + {} );</script>\[/code\]which on my Google chrome browser logs : \[code\][object Object]\[/code\]It looks wired to me! And doing something like this : \[code\]<script type="text/javascript">console.log( {} + {} );</script>\[/code\]does produce :\[code\][object Object][object Object]\[/code\]What is exactly happening over here in both the cases? How come \[code\][]\[/code\],\[code\]{}\[/code\] adding these two results in a array of \[code\]objects\[/code\]? Thanks in advance.
 
Top