Tell us what’s happening:
Describe your issue in detail here.
Assalmulaikum Sir in my code the problem I am facing is that when I console the char code value using function charcodeat it gives me the wrong answer only when I am performing this in array plz check my code especially line 3 and line 9 (when i is 4)
**Your code so far**
function rot13(str) {
let a="P";
console.log(a.charCodeAt(0))
let pattern=/[A-Z]/ig;
let result=str.match(pattern);
console.log(result);
for (let i=0;i<result.length;i++)
{
console.log(i+" "+str.charCodeAt(i));
result[i]=String.fromCharCode(str.charCodeAt(i)+13-((Math.floor((str.charCodeAt(i)-65)/13))*26));
}
console.log(result)
return str;
}
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/92.0.4515.131 Safari/537.36
Challenge: Caesars Cipher
Link to the challenge: