// BMK千位缩写
this.numShort = function (v, type, n, ct) {
if (typeof (v) == 'number') {
type = type.toUpperCase() || 'BMK';
ct = ct || 3;
n = n || 0;
type = type.split('');
var t = { B: 9, M: 6, K: 3 };
var v1 = String(v).split('.')[0];
var rt = v;
var w = "";
for (var i = 0, iLen = type.length; i < iLen; i++) {
var it = type[i];
if (v1.length > t[it]) {
w = it;
rt = parseFloat(v / Math.pow(10, t[it]));
break;
}
}
rt = rt.toFixed(n);
rt = this.cuter(rt, ct) + w;
return rt;
}
}
想用更多的方法请打开JavaScript基础包