JavaScript » Special » ,

This is the comma operator which is most often used to include multiple expressions where only one is required, particularly in a for loop. It evaluates both its operands and returns the value of the second.

Examples

Code:
for(var i=0, j=0; i<3; i++, j++)
   document.write(a[i][j] + "<BR>");
Explanation:

This code uses a two-dimensional array of 3 by 3 elements and initializes two counters (one for each dimension) incrementing them both, which results in a display of the left-to-right diagonal values.

Code:
for(var i=0, j=0; i<3; i++, j++)
   document.write(a[i, j] + "<BR>");
Explanation:

...while using the comma operator inside the square brackets of the this example causes the code to display all the elements of the array one row at a time.