千分位方法
2022-11-29 本文已影响0人
何家一枝花
num.toLocaleString()

// 正则匹配方法一
let num = 1234567890;
let reg = /\d{1,3}(?=(\d{3})+&,'); //"1,234,567,890"
num.toLocaleString()
// 正则匹配方法一
let num = 1234567890;
let reg = /\d{1,3}(?=(\d{3})+&,'); //"1,234,567,890"