Número com vírgulas JS
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
}
kripi__
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
}
function formatMoney(n) {
return "$ " + (Math.round(n * 100) / 100).toLocaleString();
}
n = 2123000;
// =>2,123,000
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
money comma separated