Hello! This is my first post in this forum. I just started to code a couple of months ago. I hope someone can help me. In this chalange (Caesars Cipher) I can’t figure out the last step… I found all the others algorithms pretty easy but I am really stuck on this one.
Here is my code for now:
function rot13(str) { // LBH QVQ VG!
var arr = [];
for (i=0; i< str.length; i++) {
if (str.charCodeAt(i) > 64 && str.charCodeAt(i) < 91) {
if (str.charCodeAt(i) -13 < 65) {
arr.push(str.charCodeAt(i) -13 + 26);
} else {
arr.push(str.charCodeAt(i) -13);
}
} else {
arr.push(str.charCodeAt(i));
}
}
console.log(arr);
//how to do this last step...?
//var finalStr = String.fromCharCode(arr???);
return finalStr;
}
// Change the inputs below to test
rot13("SERR PBQR PNZC");
Thank you!