function rot13(str) { // LBH QVQ VG!
for(var i=0;i<str.length;i++){
if(str.charAt(i).match(/[A-Z]/))
{
var letter=str.fromCharCode(str.charCodeAt(i)+13);
str.replace(str.charAt(i),letter);
}
}
return str;
}`Preformatted text`
`indent preformatted text by 4 spaces`
Hey guys I keep getting a type error saying fromCharCode() is not a function.
I don’t understand why.
I know that str.charCodeAt(i) returns the unicode value for a character in a string and the argument that fromCharCode() uses numbers and returns the characters corresponding to that value.