Comma(,) special operator JS Home  <<  JS Reference  <<  Comma(,)

Expression operator.

Description

The Comma(,) special operator allows use of mutiple expressions where an expression is required.

Syntax

Signature Description
expression1, expression2Use of mutiple expressions where an expression is required.

Parameters

Parameter Description
expression1, expression2The expressions we wish to replace a single expression.

Examples

Following is an examples of the Comma(,) special operator, which changes two expressions counters to produce part of the 9 times table.


// The comma(,) operator.
var tableArray = new Array(10);

for (var i = 0, j = 9; i < 10; i++, j--) { 
  tableArray[i] = i + "" + j;
}

alert(tableArray);  

Press the button below to action the above code: