Operators

Comma operator (,)

Try the free JavaScript compiler

Evaluates its left operand, discards its result, then evaluates and yields the right operand. Commas separating arguments or declarations are not necessarily comma operators.

Formal Syntax & Structure

javascript syntaxjavascript
left , right

Parameters & Attributes

NameTypeDescription
leftexpressionLeft operand.
rightexpressionRight operand; short-circuiting may skip evaluation where applicable.

Return Value

operand value

Result of the operation.

Working Example

Example Snippetjavascript
console.log((1, 2, 3));
JavaScript Reference