Tell us what’s happening:
Your code so far
function rot13(str)
{
let l=str.length;
let ans="";
for(let i=0;i<l;i++)
{
if(65<=str[i].charCodeAt()<=90)
{
let x=((str[i].charCodeAt()-65+13)%26)+65;
ans+=String.fromCharCode(x);
}
else
{
ans+=str[i];
}
}
return ans;
}
rot13("SERR PBQR PNZC");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36
.
Challenge: Caesars Cipher
Link to the challenge: