format money javascript commas

JavaScript
var n = 34523453.345
n.toLocaleString()
"34,523,453.345"
function formatMoney(n) {
    return "$ " + (Math.round(n * 100) / 100).toLocaleString();
}

n = 2123000;
// =>2,123,000x.toString().toLocaleString(); // x must be a number
Source

Also in JavaScript: