0
Can u explain this output js code?
var a=-3; for(d=1;d<5;d+=a){ document.write(d); a++; } the output are 1-1-2-2-114 can you tell me why ?
6 Answers
+ 1
it prints d
increases a by 1
then increases d by a
d pd na nd
1 1. -2 -1
-1 -1. -1 0
0. 0. 0. -1
-1. -1 1. 0
0. 0. 2. 2
2. 2. 3. 5
end of loop
hope this helps
+ 1
printed d
new a
new d
sorry bout that
+ 1
i made a table
so the top is the label
and each row represents one stage in the for loop.
0
pd na nd?
0
idont understand
0
yeah, i go it thanks