0

The expression (0, 1, 2) evaluates to 2 in ES6. I never read a code like that until now, and googling for symbols like brackets and commas is really hard. It seems to always evaluates to the last value in the "list", in this case 2 but that does not explain what is that for and what does it mean.

doc_id
  • 1,291
  • 11
  • 35
  • The [comma operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comma_Operator) existed since the beginning of ECMAScript. – Felix Kling Feb 27 '17 at 02:59
  • Also related to [What does a comma do in JavaScript expressions?](http://stackoverflow.com/q/3561043/218196) and [other questions](https://stackoverflow.com/search?q=%5Bjavascript%5D+comma+operator). – Felix Kling Feb 27 '17 at 03:01

0 Answers0