номер с запятой 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());
value.toLocaleString()
"1,000"
var number = 1000;
console.log(number.toLocaleString());
//output: 1,000