format money javascript commas
snippet in javascript

add comma to number javascript

user5009

var n = 34523453.345
n.toLocaleString()
"34,523,453.345"

format money javascript commas

user6848

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

n = 2123000;
// =>2,123,000

how to format an integer with a comma in javascript

user6994

x.toString().toLocaleString(); // x must be a number