How Can Ecmascript Assignmentexpression Production Rule Produce `foo = 42`?
As the spec states (yes, 5.1, that's intentional): AssignmentExpression : ConditionalExpression LeftHandSideExpression = AssignmentExpression LeftHandSideExpression As
Solution 1:
The expression after the =
operator must always be an AssignmentExpression. This AssignmentExpression will often consist not of another assignment, but a plain ConditionalExpression, which in turn will consist of a simpler expression that might contain an operator or not, all the way down through the operator precedence hierarchy to the Literal that your number 123
forms.
Post a Comment for "How Can Ecmascript Assignmentexpression Production Rule Produce `foo = 42`?"