What does the comma operator do?

Comma operator is applied and the value 5 is used to determine the conditional’s true/false. It will execute blah() and get something back (presumably), then the comma operator is employed and 5 will be the only thing that is used to determine the true/false value for the expression. Note that the , operator could be … Read more

C comma operator

Section 6.6/3, “Constant expressions”, of the ISO C99 standard is the section you need. It states: Constant expressions shall not contain assignment, increment, decrement, function-call, or comma operators, except when they are contained within a subexpression that is not evaluated. In the C99 rationale document from ISO, there’s this little snippet: An integer constant expression … Read more

What does the comma operator do in JavaScript?

The comma operator evaluates both of its operands (from left to right) and returns the value of the second operand. Source: https://developer.mozilla.org/en/JavaScript/Reference/Operators/Special_Operators/Comma_Operator For example, the expression 1,2,3,4,5 evaluates to 5. Obviously the comma operator is useful only for operations with side-effects. console.log(1,2,3,4,5); console.log((1,2,3,4,5));

What does a comma do in JavaScript expressions?

The comma operator evaluates both of its operands (from left to right) and returns the value of the second operand. Source: https://developer.mozilla.org/en/JavaScript/Reference/Operators/Special_Operators/Comma_Operator For example, the expression 1,2,3,4,5 evaluates to 5. Obviously the comma operator is useful only for operations with side-effects. console.log(1,2,3,4,5); console.log((1,2,3,4,5));

tech