function commafy(num){
  return num && num
    .toString()
    .replace(/(\d)(?=(\d{3})+\.)/g, function($1, $2){
      return $2 + ',';
    });
}

console.log(commafy(1200000123123.223))
let milliFormat = (input) => {
  return input && input.toString()
      .replace(/(^|\s)\d+/g, (m) => m.replace(/(?=(?!\b)(\d{3})+$)/g, ','))
}

console.log(milliFormat(1200000123123.223))

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-02
  • 2022-12-23
  • 2021-10-09
  • 2022-12-23
猜你喜欢
  • 2021-07-16
  • 2022-02-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案