javascript number fixed decimal code example
Example 1: javascript fixed decimal
var num = 5.56789;
var n = num.toFixed(2);
Example 2: tofixed currency in js
(12345.67).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,'); // 12,345.67
var num = 5.56789;
var n = num.toFixed(2);
(12345.67).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,'); // 12,345.67