Outline

Math in JavaScript has few odd quirks. One of them results in slight inaccuracy when operating over decimals numbers, like so:

0.2 + .01    // 0.30000000000000004
0.2 + 0.7    // 0.8999999999999999

There are a few ways you might handle this. You may consider performing complex and precise computations on a server in a more suitable language. For a quix fix, you can use the .toFixed() method to return the number to a fixed amount of decimals.

(0.2 + .01).toFixed(2)    // "0.30"
(0.2 + 0.7).toFixed(2)    // "0.90"
 

I finished! On to the next chapter