+ ;
- An empty array (
- An empty object (
- An empty string (
- Zero (
This is one of the questions we had in a work quiz last week, taken from the classic 'wat' talk. It's a good laugh if you haven't seen it before.
The answer? An empty string.
This might seem weird if you're used to statically-typed languages, but it makes sense when you break it down. What's happening here is called type coercion.
Array.prototype.toString() method automatically on each array. It then concatenates these strings, and of course, adding two empty strings together results in another empty string.
// Adding two empty arrays:
 + ;
// Is like adding two empty strings:
'' + '';
// Because this is what really happens:
.toString() + .toString();
It's more obvious when the arrays have values:
 + [' cards']; // '52 cards'
That being said, I've started learning TypeScript for my job, and it's great. My friend Charles Roper recommended TypeScript in 50 Lessons. Definitely check it out if you're interested in learning TypeScript!