Saturday, 10 June 2017

Bigger than stops on invalid number

I have a variable set like this: x = 1; and I have made an interval which every 100 milliseconds adds to the x + 0.1, inside the Interval I have a if which checks for if x is bigger than something. So I was testing around and I saw that IF was called on a wrong time.

Code:

if(Math.pow(1.06, 18.90).toFixed(2) >= 24.91){
    clearInterval(timer);
}

As you can see, X was 18.90, but if using the math function it equals to 3.01 how can that be bigger than 24.91?



via Jordn

No comments:

Post a Comment