July 1998
Intermediate to advanced
1456 pages
65h 5m
English
, — NN 2 IE J1 ECMA 1
The comma operator. This operator can delimit expressions in the same line of script. It can be used in a number of ways. For example, to declare multiple variables, the syntax would be:
var varName1, varName2, ... varNameN
Multiple script statements may also be joined together on the same line. Therefore, the following script line:
alert("Howdy"),alert("Doody")presents two alert dialog boxes in sequence (the second one appears
after the first is dismissed by the user). Another application is in
for loops when you wish to involve two (or more)
variables in the loop:
for (var i = 0, var j = 2; i < 20; i++, j++) {
...
}var isNav, isIE
Read now
Unlock full access