ECMAScript 11.6.1 defines addition. Steps 5 and 6 of addition call ToPrimitive
(9.1) for each operand and operate on those results:
For an array (or any object), ToPrimative
calls the toString
method of the object. The result of calling toString
on an empty array is the empty string (per the behavior described in 15.4.4.2.
For a number, ToPrimitive
returns the number (since numbers are already primitive).
We're left adding the empty string and the number 1. When either operand in addition is a string, the addition acts as a concatenation operation (per addition's step 7), so we end up with "" + "1" = "1"
.