1function nFormatter(num) {
2 if (num >= 1000000000) {
3 return (num / 1000000000).toFixed(1).replace(/\.0$/, '') + 'G';
4 }
5 if (num >= 1000000) {
6 return (num / 1000000).toFixed(1).replace(/\.0$/, '') + 'M';
7 }
8 if (num >= 1000) {
9 return (num / 1000).toFixed(1).replace(/\.0$/, '') + 'K';
10 }
11 return num;
12}
13