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