js数字千位符
1、方法
const formatThousand = data => {
let type = Object.prototype.toString.call(data);
if (type === "[object Number]") {
return data
.toString()
.replace(/(^|\s)\d+/g, m => m.replace(/(?=(?!\b)(\d{3})+$)/g, ","));
} else {
return data;
}
};