2.1.31 [ECMA-262-1999] Section 11.6.1, The Addition Operator ( + )

V0048:

The addition operator either performs string concatenation or numeric addition.

The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression is evaluated as follows:

  1. Evaluate AdditiveExpression.

  2. Call GetValue(Result(1)).

  3. Evaluate MultiplicativeExpression.

  4. Call GetValue(Result(3)).

  5. Call ToPrimitive(Result(2)).

    1. __If an exception was thrown during step 5 but not caught, return undefined (execution now proceeds as if no exception were thrown).__

  6. Call ToPrimitive(Result(4)).

    1. __If an exception was thrown during step 6 but not caught, return Result(5) (execution now proceeds as if no exception were thrown).__

  7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12. (Note that this step differs from step 3 in the comparison algorithm for the relational operators, by using or instead of and.)

  8. Call ToNumber(Result(5)).

  9. Call ToNumber(Result(6)).

  10. Apply the addition operation to Result(8) and Result(9). See the note below ([ECMA-262-1999] section 11.6.3).

  11. Return Result(10).

  12. Call ToString(Result(5)).

  13. Call ToString(Result(6)).

  14. Concatenate Result(12) followed by Result(13).

  15. Return Result(14).

The behavior described by steps 5.1 and 6.1 is an unintentional implementation defect that is present in all versions of JScript 5.x up to and including JScript 5.8.