Hope you all had a good start in 2017! I’m having difficulty with this challenge- Caesars Cipher, I can’t work out what goes wrong with my code. Can someone please help me? Thanks!
function rot13(str) {
var result ="";
for(var i =0; i<str.length; i++){
if(str.charCodeAt(i)<65||str.charCodeAt(i)>90){
result.push(str.charAt(i));
} else if(str.charCodeAt(i)>77){
result.push(str.fromCharCode(str.charCodeAt(i)-13));
}else {
result.push(str.fromCharCode(str.charCodeAt(i)+13));
}
}
return result;
}
I have a feeling you dont debug (step through) your code … so before i give you the mistakes i ask that you try using this link i supplied below … paste your code in it and set it for javascript ESB then you can step through each line and see where problems are … it will be a great help to you in the future … i use this all the time
still have problems … i have to go out now be back shortly and will list what i found