var DecimalSeparator = Number("1.2").toLocaleString().substr(1,1);
var AmountWithCommas = Amount.toLocaleString();
var arParts = String(AmountWithCommas).split(DecimalSeparator);
var intPart = arParts[0];
var decPart = (arParts.length > 1 ? arParts[1] : '');
decPart = (decPart + '00').substr(0,2);
return '$ ' + intPart + DecimalSeparator + decPart;
Recent Posts
Showing posts with label money. Show all posts
Showing posts with label money. Show all posts
How to format number as money with JavaScript
Subscribe to:
Posts (Atom)