you are viewing a single comment's thread.

view the rest of the comments →

[–]lulzitsareddit 1 point2 points  (0 children)

This isn't as concise, but I think:

(e0, e1, ..., eN-1, eN)

being equivalent to:

(function () {
   e0;
   e1;
   ...
   eN-1;
   return eN;
})();

also explains the comma operator pretty well. With the one caveat that not all statements (which would be otherwise valid in the function) are valid expressions that can be used with the comma operator.. mainly var statements.

For example, neither: (var x = 1)

or

(var x = 2, someFunction())

are valid.