Friday, November 16, 2012

JavaScript array and object addition

I\’m testin some JavaScript concepts and I\’m trying to understand why:



typeof({} + {})
typeof([] + [])


return a \’string\’ yet:



typeof {}
typeof []


return an \’object\’


I\’ve tried this in NodeJS, FireFox, Chrome and IE9 all with the same results.






Rating: 3 out of 5 based on 3 ratings



The post JavaScript array and object addition appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/javascript-array-and-object-addition.html

No comments:

Post a Comment