js 1000+简写为K,10000+简写为W
function numFormat(num) {
if(num >= 10000) {
num = Math.round(num/1000)/10 + 'W';
} else if (num >= 1000) {
num = Math.round(num/100)/10 + 'K';
}
return num;
}
console.log(numFormat(1000), numFormat(20001), numFormat(3000300));