Comma operator in Arrow functions

Allen Wirfs-Brock allen at wirfs-brock.com
Sat Mar 14 20:41:40 UTC 2015


On Mar 14, 2015, at 1:00 PM, Caitlin Potter wrote:

>> no, comma is the lowest precedence of any operator.
> 
> I think you might have misunderstood what I was saying?
> 
> ConciseBody -> AssignmentExpression -> comma is not a part of the ConciseBody -> you probably get a SyntaxError unless the arrow function is passed as a parameter to a function
> 
> So: `var a = (x) => 1, 2;` -> syntax error (not a VariableDeclaration)
> 

agreed, because the RHS of an Initializer must be an AssignmentStatement.

Allen


More information about the es-discuss mailing list