Tell us what’s happening:
Your code so far
function rot13(str) { // LBH QVQ VG!
var Arr = str.split(" ");
//var ar = Arr[0].split('');
var aa="\"";
var a='';
var Arre=[];
for(var j=0;j<Arr.length;j++){
var ar = Arr[j].split('');
for(var i=0;i<ar.length;i++){
if(ar[i].charCodeAt() > 64 || ar[i].charCodeAt() > 97 && ar[i].charCodeAt() != 32){
var bb = ar[i].charCodeAt();
if(bb>77){
a = String.fromCharCode(bb -13);
}else{
a = String.fromCharCode(bb +13);
}
Arre.push(a);
}else{
Arre.push(ar[i]);
}
}
Arre.push(" ");
}
aa = Arre.join('').trim();
return "\""+aa+"\"";
}
// Change the inputs below to test
rot13("SERR CVMMN!");
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1; 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