+"123"
can be parsed as a unary + operator followed by line 123
. As you can see in the specification, the task of the unary + operator, in particular, is to distinguish its operand from the Number type.
"123"+
cannot be parsed as a valid JS expression, because the operand should always follow the token +
, regardless of whether it should be parsed as a unary + operator or binary + add operator.
Aaron source share