2

Why empty object + empty object equal to non-empty string, empty array + empty array equal to empty string and empty object + empty array equal to zero?

[] + [] = ""

[] + {} = "[object Object]"

{} + {} = "[object Object][object Object]"

{} + [] = 0
  • 2
    The really interesting one is the the 4th one. That one is doing extra casting. The rest are just calling `toString()` and are fairly expected.. – 4castle Jul 02 '16 at 20:24
  • @4castle not exactly, on the 4th one, the "object" is not really a type, just an empty code block... – JCOC611 Jul 02 '16 at 20:29

0 Answers0