Morning guys I am currently doing the caesars cipher challenge and I am stuck in trying to convert the unicode back to a string to complete the decryption. I tried using the fromCharCode() method to convert the uni code to a string but it isn’t working. my Code is shown below:
function rot13(str) {
var cipherText = '';
var newCipher = [];
var newString = str.split('');
for (i = 0; i < str.length; i++) {
if (newString[i].charCodeAt() >= 65 && newString[i].charCodeAt() <= 90){
newString[i].charCodeAt();
if (newString[i].charCodeAt() < 78) {
newCipher[i] = (newString[i].charCodeAt() + 13);
}
else if (newString[i].charCodeAt() >= 78) {
newCipher[i] = (newString[i].charCodeAt() - 13);
}
cipherText = newCipher.join(' ');
}
}
return cipherText;
}
// Change the inputs below to test
rot13("SERR PBQR PNZC ?");
Please help me guy