Can anyone please explain the comma operator in FOR statement?
function funct_1(c){
for (var a = x, e = y; 0 < c; ){
var p = c/2;
var c = c/10; // wtf, it is already defined as function argument!!
}
}
Also, the last statement like "a++" seems to be missing. I have never seen anything like this. what does that mean?
The comma just adds separation for multiple declarations. In other words, your
for
loop is settinga
equal tox
, as well ase
equal toy
.As for the lack of the increment statement, the fact that it is missing just means that the
for
loop won't explicitly increment any variable.