js实现千位分隔符分割
function format(num) { var reg = /\d{1,3}(?=(\d{3})+$)/g; return (num + '').replace(reg, '$&,'); } console.log(format(123456789));//123,456,789
function format(num) { var reg = /\d{1,3}(?=(\d{3})+$)/g; return (num + '').replace(reg, '$&,'); } console.log(format(123456789));//123,456,789