+ 6
How did we come to this answer
var x = 0; for (; x <= 20; x += 2) { document.write(x); } Why is this 2? (; x += 2)
2 odpowiedzi
+ 12
var x = 0;
for ( ; x <= 20; x += 2 )
{
document.write(x);
}
------------------------------
Q. Why is this 2 ( x += 2 )
A. 2 is the increment, there is no needed of explanation, 2 is simply the increment of x variable. The loop will prints the 2's multiple, it will ends to 20!
------------------------------
Please use an appropriate syntax, your code is too confusing.