3 ms·
That's Javascript for you. Summing arrays calls `.toString()` on them, and two empty string gives you a new empty string. [].toString() === '' [] + []
by abdusco 5y ago
That's Javascript for you.
Summing arrays calls `.toString()` on them, and two empty string gives you a new empty string.
[].toString() === ''
[] + []
=== '' + ''
=== ''
https://github.com/denysdovhan/wtfjs#adding-arrays https://github.com/denysdovhan/wtfjs#adding-arrays