for( count = 0.01; count <= 0.20; count + 0.01 )
Is this valid? Because it seems as soon as I changed it to this from count++
, my firefox crashed.
for( count = 0.01; count <= 0.20; count + 0.01 )
Is this valid? Because it seems as soon as I changed it to this from count++
, my firefox crashed.
for( count = 0.01; count <= 0.20; count += 0.01 )
You were missing an =
operator in the last section of the for loop. Otherwise it would be an infinite loop.
If you use this code, you'll get values like
If you really want a predictable count, keep the loop integer, and rescale down to the fractional number you need:
for( count = 1; count <= 20; count++ ) console.log(count/100)
This produces values like 0.06 and 0.12, like you would expect.