== Why is this an issue? The comma operator takes two expressions, executes them from left to right, and returns the result of the second one. The use of this operator is generally detrimental to the readability and reliability of code, and the same effect can be achieved by other means. [source,javascript] ---- i = a += 2, a + b; // Noncompliant: What's the value of i ? ---- Writing each expression on its own line will improve readability and might fix misunderstandings. [source,javascript] ---- a += 2; i = a + b; // We probably expected to assign the result of the addition to i, although the previous code wasn't doing it. ---- === Exceptions The comma operator is tolerated: * In initializations and increment expressions of ``++for++`` loops. [source,javascript] ---- for (i = 0, j = 5; i < 6; i++, j++) { ... } ---- * If the expression sequence is explicitly wrapped in parentheses. [source,javascript] ---- i = (a += 2, a + b); // Compliant by exception ---- == Resources === Documentation * MDN web docs - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comma_operator[Comma operator (,)] ifdef::env-github,rspecator-view[] ''' == Implementation Specification (visible only on this page) include::../message.adoc[] ''' == Comments And Links (visible only on this page) include::../comments-and-links.adoc[] endif::env-github,rspecator-view[]