0
for loop statement 3
using pre increment gave the result as the post increment post increment i for (i=1; i<=5; i++) { document.write(i + "<br />"); pre increment i will give same results for (i=1; i<=5; ++ i) { document.write(i + "<br />");
2 odpowiedzi
+ 6
That is because they differ where they are assigned to some variable...
x = y++ // y is assigned to x, then incremented
x = ++y // y is incremented then assigned to x.
However, when they are on a single line, they would act the same...
y++
x = y // y is incremented on first line and assigned on second
++y
x = y // y is incremented on first line and assifned on second.
0
Thanks