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 setting a
equal to x
, as well as e
equal to y
.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With