RsD0p9BK
12/19/2014 - 2:04 PM

toFixed.js

// http://stackoverflow.com/questions/1726630/javascript-formatting-number-with-exactly-two-decimals
(10.8).toFixed(2); // 10.80

// http://stackoverflow.com/questions/5623096/how-do-i-format-a-number-to-2-decimal-places-but-only-if-there-are-already-deci
(18.00).toFixed(2).replace(/[.,]00$/, ""); // 10