// 方法1
var separator=(num)=>{
if(!num){
return '0.00';
};
let str = parseFloat(num).toFixed(2);
return str && str
.toString()
.replace(/(\d)(?=(\d{3})+.)/g, function(1) {
return $1 + ",";
});
}
separator(386485473.88) //"386,485,473.88"
//方法2:
(386485473.88).toLocaleString('en-US') // "386,485,473.88" 由 (sRect)補(bǔ)充