给数字添加千分位

 
      // const science = (num) => { 
      //   var str = '';
      //   if(typeof num == 'number') {
      //       str = num.toString();
      //   } else if(typeof num == 'string'){
      //       str = num;
      //   } else {
      //       return num;
      //   }
      //   var re = /(?=(?!\b)(\d{3})+$)/g; 
      //   return str.replace(re, ','); 
      // }
posted @ 2020-04-03 16:30  有肌肉的小眼睛  阅读(150)  评论(0)    收藏  举报