formatNumber(value, valueSymbol){
let balance = Intl.NumberFormat().format(value);
if (!/\./.test(balance)) {
balance += '.00'
}
if(balance.split(".")[1].length === 1){
balance += '0'
}
return valueSymbol + balance;
}
formatNumber(2110428.831, "$") ===> $2,110,428.83
formatNumber(2110428.8, "$") ===> $2,110,428.80
formatNumber(2110428, "$") ===> $2,110,428.00
06-17
6615
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
01-18
238
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
09-30
1665
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)