/**
* 数字转为千分位字符
* @param {Number} num
* @param {Number} point 保留几位小数,默认2位
*/
function parseToThousandth(num, point = 2) {
let [sInt, sFloat] = (Number.isInteger(num) ? `${num}` : num.toFixed(point)).split('.');
sInt = sInt.replace(/\d(?=(\d{3})+$)/g, '$&,');
return sFloat ? `${sInt}.${sFloat}` : `${sInt}`;
} parseToThousandth(1234567); // '1,234,567'
05-07 15:45