The toFixed(9) rounds the value at the 9th digital after decimal point and that also keeps those digital there even if they are all 0, like 1.500000000. To call parseFloat can trim the 0 out, like converting 1.500000000 => 1.5. That's why I use parseFloat after toFixed.