numer z Comcas 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
var number = 3500;
console.log(new Intl.NumberFormat().format(number));
// → '3,500' if in US English locale
var number = 3500;
console.log(number.toLocaleString());
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);
}