var computeST = 2145523
var resultFormat= <-- format the computeST here -->
alert(resultFormat);
显示警报应为
2,145,523
有人可以帮助我吗?
最佳答案
尝试这个:
console.log(numberWithCommas(2145523));
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
关于javascript - 如何在JavaScript中将数字格式化为没有小数点的货币?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23645374/