数字千分位正则自动转换

Number.prototype.thousandth = function() {
  return `${this}`.replace(/\d{1,3}(?=(\d{3})+$)/g, '$&,');
};

 

posted @ 2020-04-24 17:10  黎明の破晓  阅读(869)  评论(0编辑  收藏  举报