Tell us what’s happening:
Hi Everyone,
I have been stuck on this for a while now. I am able to return the proper numbers but I cannot convert them back to letters. What am I doing wrong?
Thank you in Advance for your help!
Your code so far
function rot13(str) { // LBH QVQ VG!
var result = [];
for(var i = 0; i<str.length; i++){
result.push(str[i].charCodeAt());
if(result[i] < 78 && result[i] > 64){
result[i]+= 13;
}else if(result[i] > 77 && result[i] < 91){
result[i]-=13;
}
}
String.fromCharCode(result);
}
// 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