var
syntax allows multiple assignment, so when you see the following, you're declaring multiple variables using one var
statement.
var a, b, c;
Note that this syntax is not the comma operator.
The ,
can be used as the comma operator. It simply evaluates a series of expressions. So when you see the following syntax, you are seeing a series of expressions being evaluated, and the return value of the last one being returned.
x = (y = x, z)
Within the parens, x
is assigned to y
, then z
is evaluated and returned from the ()
and assigned to x
.
I'd suggest that this syntax is unclear and offers little benefit.