BartlomiejSkwira
4/5/2013 - 7:48 AM

Format decimal points in Javascript floats

Format decimal points in Javascript floats

var profits=2489.8237
profits.toFixed(3) //returns 2489.824 (round up)
profits.toFixed(2) //returns 2489.82
profits.toFixed(7) //returns 2489.8237000 (padding)