function formatterMoney(money){
let moneyStr = money.toString();
if(moneyStr.length < 4){
return;
}
let str = '',i = 3;
for(; i < moneyStr.length;i+=3){
str = ','+moneyStr.substr(moneyStr.length-i,3) + str;
}
i-=3;
str = moneyStr.substr(0,moneyStr.length-i) + str;
return str;
}
效果演示