right now i have this regex to return numbers with formatted digits.
function formatCurrency(amount) {
var amt = ""+amount;
return amt.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
}
The result for any provided number is coming as Due: $1,944.5. But I need to add two digits after decimal i., it should come as Due: $1,944.50. Please help me with the correct regex to add two digits after decimal points. Thanks for your help.