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 ?

26th Feb 2017, 4:15 AM
フェăƒȘăƒŒ
フェăƒȘăƒŒ - avatar
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
26th Feb 2017, 4:39 AM
Michael Szczepanski
Michael Szczepanski - avatar
+ 1
printed d new a new d sorry bout that
26th Feb 2017, 5:03 AM
Michael Szczepanski
Michael Szczepanski - avatar
+ 1
i made a table so the top is the label and each row represents one stage in the for loop.
26th Feb 2017, 5:11 AM
Michael Szczepanski
Michael Szczepanski - avatar
0
pd na nd?
26th Feb 2017, 4:58 AM
フェăƒȘăƒŒ
フェăƒȘăƒŒ - avatar
0
idont understand
26th Feb 2017, 5:08 AM
フェăƒȘăƒŒ
フェăƒȘăƒŒ - avatar
0
yeah, i go it thanks
26th Feb 2017, 5:24 AM
フェăƒȘăƒŒ
フェăƒȘăƒŒ - avatar