/**

* 数字进行千位转换成字符串

*/

function escapeThousands(int) {

   let num = (int || 0).toString(), result = '';

   while(num.length > 3) {

       result = ',' + num.slice(-3) + result;

       num = num.slice(0, num.length - 3);

   }

   if (num) {

       result = num + result;

   }

   return result;

}

 

文章来源:刘俊涛的博客

欢迎关注,有问题一起学习欢迎留言、评论。

TAG标签: 微信小程序num

http://www.xiaochengxub.com/read-100254.html