function zipNum(num, radix){
if (!zipNum.zip){
zipNum.zip = function(inputNum){
if(inputNum > 35){//36-61 を表すには大文字を使用します
return String.fromCharCode ('A' .charCodeAt (0) inputNum % 36); 🎜> if(radix > 36 && radix result = [];
do {
剰余 =商 % radix;
quotient = parseInt(quotient / radix);
result.push(zipNum.zip( REMAINDER);
} While (quotient & gt; radix);
Remainer = 商 %基数;
If (Remair! == 0) {
Result.push (zi pnum.zip (remainer) );
}
result = result.reverse().join('') ;
} else if(radix > 1 && radix result = num.toString(radix);
} else {
result = num;
window.console && console.warn('基数引数は 2 ~ 62 である必要があります')
}
return result;
}
function testSortNum(){
assertEquals(zipNum(61, 62), 'Z');
assertEquals(zipNum(62 * 2 - 1, 62), '1Z') ;
assertEquals(zipNum(62 * 3 - 1, 62), '2Z');
assertEquals(zipNum(1361182624991, 62), 'dXN5fJB');
}
testSortNum();