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, ',');
}
var number = 3500;
console.log(number.toLocaleString());
foramtNumber = (num,div=",")=>{
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, div);
}