String.prototype.toThousands = function(){
return this.replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")
}
'3800000.88'.toMoney() //"3,800,000.88"
'38000.000'.toMoney() //"38,000.000"
String.prototype.toThousands = function(){
return this.replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")
}
'3800000.88'.toMoney() //"3,800,000.88"
'38000.000'.toMoney() //"38,000.000"
转载于:https://www.cnblogs.com/damade/p/4195324.html