B
bob
Hi,
Question about For (...).
I did this:
for (i=1;i=5;i++)
alert(i)
and i get an infinite loop with value '5'. I thought that 'i=5' was the test
which must be 'true' in order to execute 'alert(i)'. It's normal that i
don't get 1 to 4 because in those case, the test is false. When i=5, i get
alert(i) with 5 but appearantely, i never equals 6.
By the way, is there a difference between i++ and ++i? I tried both but
didn't find any difference.
Thanks
bob
Question about For (...).
I did this:
for (i=1;i=5;i++)
alert(i)
and i get an infinite loop with value '5'. I thought that 'i=5' was the test
which must be 'true' in order to execute 'alert(i)'. It's normal that i
don't get 1 to 4 because in those case, the test is false. When i=5, i get
alert(i) with 5 but appearantely, i never equals 6.
By the way, is there a difference between i++ and ++i? I tried both but
didn't find any difference.
Thanks
bob