function thousandBitSeparator(num) {
  num=num.toFixed(2);
   return num && num
   .toString()
   .replace(/(\d)(?=(\d{3})+\.)/g, function($1,$2) {
   return $2 + ",";
   });
}
console.log(thousandBitSeparator(-111111111111110.0000001));

  

posted on 2017-07-13 19:09  太阳花0525  阅读(242)  评论(0编辑  收藏  举报