精益助手里面 js系统运行就显示错误,用浏览器运行就能正常计算出来,请问下是哪里需要改,我生成易语言也是错误的,代码已经附上求大神改一下
[JavaScript] 纯文本查看 复制代码 var NumToStr = {
base: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
ben: 62,
toBase: function(num) {
let arr = [];
while (num > 0) {
arr.push(NumToStr.base[num % NumToStr.ben]);
num = Math.floor(num / NumToStr.ben);
}
return arr.reverse().join('');
},
to10: function(baseNum) {
baseNum = baseNum.split('').reverse().join('');
let val = 0;
for (let i = 0; i < baseNum.length; i++) {
let c = baseNum;
val += (NumToStr.base.indexOf(c) * Math.pow(NumToStr.ben, i));
}
return val;
},
}
|