Caesars Cipher (Solved)

Caesars Cipher (Solved)
0.0 0

#1

function show(str) { // LBH QVQ VG!
var output = ‘’;
for (var i = 0; i < str.length; i ++) {
//Get the character we’ll be appending
var c = str[i];
//Checks if it’s a letter…
if (c.match(/[a-z]/i)) {
//Get its code
var code = str.charCodeAt(i);
//Uppercase letters
if ((code >= 65) && (code <= 77)){
c = String.fromCharCode(((code - 65) % 13) + 78);
}
else if ((code >= 78) && (code <= 91)){
c = String.fromCharCode(((code - 65) % 13) + 65);
}
//Lowercase letters
else if ((code >= 97) && (code <= 109)){
c = String.fromCharCode(((code - 97) % 13) + 110);
}
else if((code >= 110) && (code <= 122)){
c = String.fromCharCode(((code - 97) % 13) + 97);
}
}
output += c;
}
//Shows the decrypted message
return output;
}