实现数字的千分位显示方式

  1. 方法一:利用正则表达式实现
    let num = 12312312312;
    let thousand = num.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,');
    console.log(thousand);

评论

暂无评论