Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

format money javascript commas

function formatMoney(n) {
    return "$ " + (Math.round(n * 100) / 100).toLocaleString();
}

n = 2123000;
// =>2,123,000
 
PREVIOUS NEXT
Tagged: #format #money #javascript #commas
ADD COMMENT
Topic
Name
4+2 =