标签:AC 增加 OLE var let ace ret console $1
例如 123456.78 需要显示为123,456.78
```
function numFormat(num){
let res=num.toString().replace(/\d+/, function(n){ // 先提取整数部分
return n.replace(/(\d)(?=(\d{3})+$)/g,function($1){
return $1+",";
});
})
return res;
}
var a=123456789.87;
console.log(numFormat(a)); // "123,456,789.87"
```
标签:AC 增加 OLE var let ace ret console $1
原文地址:https://www.cnblogs.com/zjwxy/p/9174145.html