运行代码后,我在窗口中没有得到任何结果。我找不到问题结果必须是从 charCode 创建的字符串。
function rot13(str) {
var te = [];
var i = 0;
var a = 0;
var newte = [];
while (i < str.length) {
te[i] = str.charCodeAt(i);
i++;
}
while (a != te.length) {
if (te[a] < 65) {
newte[a] = te[a] + 13;
} else
newte[a] = te[a];
a++;
}
var mystring = String.fromCharCode(newte);
return mystring;
}
// Change the inputs below to test
rot13("SERR PBQR PNZC");