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, ',');
}
网友评论