var summoney=1040.010400000000000001;

var totalMoney=parseFloat(summoney).toFixed(2);
var arry=totalMoney.split(".");
if(arry[0].length>3){
totalMoney=arry[0].toString().replace(/(\d+?)(?=(?:\d{3})+$)/g,
"$1,")+"."+arry[1];
}

print: 1,040.01

 

相关文章:

  • 2021-07-16
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
  • 2022-12-23
猜你喜欢
  • 2021-08-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案