Call 9.513.toFixed() => 10
Call 9.226.toFixed(2) => 9.23
Why would you want that to auto round. If I wanted to round I would have round.
Not only that, the toFixed is not always rounding as expected.
Anyhow, here is how to do a toFixed accurately:You can put it in the Number.prototype if you really want to, personally I rather put it in a untils object.