номер с запятой 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(new Intl.NumberFormat().format(number));
// → '3,500' if in US English locale
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
foramtNumber = (num,div=",")=>{
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, div);
}