📅  最后修改于: 2022-03-11 15:04:26.885000             🧑  作者: Mango
Example: 10000000.2345 -> '1,000,000.2345'
function numberWithCommas(x) {
var parts = x.toString().split(".");
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
return parts.join(".");
}