dev

javascript format (round) number:


var n = 12345.6789;

n.toFixed(); // 12346

n.toFixed(1); // 12345.7

n.toFixed(6); // 12345.678900

(1.23e+20).toFixed(2); // 123000000000000000000.00

(1.23e-10).toFixed(2); // 0.00

Leave a Comment