This article mainly introduces the conversion function, used to compress the number, such as Date.now () such a long number, with 62 in the system, it is shorter, we refer to the use of the bar
The code is as follows: function zipnum (num, radix) { if (!zipnum.zip) { Zipnum.zip = function (input Num) { if (Inputnum > 35) {//In uppercase letter 36-61 &NB Sp return String.fromCharCode (' A '. charCodeAt (0) + inputnum% 36); } else if (Inputnum > 9) {///in lowercase letter 10-35 &NB Sp return String.fromCharCode (' a '. charCodeAt (0) + inputnum% 10); } else { return Inputnum ; { } var quotient = num , remainder, result; if (Radix > && radix <) { result = []; &N Bsp Do { remainder = quotient% radix;nbsp quotient = parseint (Quotient/radix); Result.push (zipnum.zip (remainder)); }while (quotient > Radix); remainder = quotient% radix; if (remainder!== 0) { Result.push (Zipnum.zip Remainde R)); } result = Result.reverse (). Join ("); } else if (Radix > 1 && Radix <) { result = num.tostring (radix); } else { result = num; Window.console && con Sole.warn (' radix argument must be between 2 ") } return result; } function Testsortnum () { assertequals (Zipnum (), ' Z '); Assertequals (Zipnum (62 * 2 -1, the ' 1Z '); AssertequaLS (zipnum (3-1), ' 2Z '); Assertequals (Zipnum (1361182624991,), ' DXN5FJB '); } testsortnum ();