Tell us what’s happening:
Your code so far
function rot13(str) { // LBH QVQ VG!
charArr=[];
rot13CharArr=[];
for (i=0; i<str.length; i++){
charArr[i]=str.charCodeAt(i);
}
charStr=charArr.join();
for (i=0; i<charArr.length; i++) {
if (64<charArr[i]<78){
rot13CharArr[i]=String.fromCharCode(charArr[i]+13);
}
else if (77<charArr[i]<91) {
rot13CharArr[i]=String.fromCharCode(charArr[i]-13);
}
else if (charArr<65 || charArr>90) {
rot13CharArr[i]=String.fromCharCode(charArr[i]);
}
}
return rot13CharArr;
}
// Change the inputs below to test
rot13("SERR PBQR PNZC");
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/caesars-cipher