js数字金额按照千位划分

文章描述:

javascript把数字金额按照千位划分

 

let str = 125000000;
let money = str.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1' + ( ','));
console.log(money);

结果:125,000,000

发布时间:2023/08/28

发表评论