Why Array + Array equals empty string?
<p>I've seen this pretty funny <a href="https://www.destroyallsoftware.com/talks/wat">screencast</a> yesterday about some oddities in languages like Ruby and Javascript and the guy shows that:</p>

<pre><code>[] + [] -&gt; ""  // returns empty string
</code></pre>

<p>not very obvious...</p>

<p>I've decided to go to the <a href="http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf">ECMAscript language specification</a> to get more info. I've started with the <code>+</code> operator implementation (p.75) which says:</p>

<blockquote>
  <p><strong>11.6.1 The Addition operator ( + )</strong></p>
  
  <p>The addition operator either performs string concatenation or numeric addition.<br>
  The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression is evaluated as follows:<br>
  1. Let lref be the result of evaluating AdditiveExpression.<br>
  2. Let lval be GetValue(lref).<br>
  3. Let rref be the result of evaluating MultiplicativeExpression.<br>
  4. Let rval be GetValue(rref) .<br>
  5. Let lprim be ToPrimitive(lval).<br>
  6. Let rprim be ToPrimitive(rval).<br>
  7. If Type(lprim) is String or Type(rprim) is String, then<br>
  a. Return the String that is the result of concatenating ToString(lprim) followed by ToString(rprim)<br>
  8. Return the result of applying the addition operation to ToNumber(lprim) and ToNumber(rprim). See the  Note below 11.6.3.    </p>
  
  <p>NOTE1 No hint is provided in the calls to ToPrimitive in steps 5 and 6. All native ECMAScript objects except Date  objects handle the absence of a hint as if the hint Number were given; Date objects handle the absence of a hint as if the  hint String were given. Host objects may handle the absence of a hint in some other manner.     </p>
  
  <p>NOTE 2 Step 7 differs from step 3  of the comparison algorithm for the relational operators (11.8.5), by using  the  logical-or operation instead of the logical-and operation.</p>
</blockquote>

<p>My guess was that the point 7 was reached in some way through different evaluations/conversions as described before but I cannot figure out what is really happenning...</p>

<p>Can someone provide a much straightforward explanation for this ?</p>

<hr>

<p>I'm willing to understand all this a bit better in order to try to answer why:</p>

<pre><code>[] + {} -&gt; [object Object]
{} + [] -&gt; 0
</code></pre>
