You may be familiar with caeser cipher(see this wiki on caesers cipher AKA ROT13)
I have been looking at solutions for the cipher but I do not see anyone using a switch statement. Given the challenge (see below), can this problem be simply solved by using a switch
statement? I have put my code below but it does not work.
function cciph(str) {
var code = "";
switch {switch (str) {
case 'A':
code = "N";
break;
case 'B:
code = 'O';
break;
//.....
case 'M': code = 'Z';
}
return str;
}
cciph("GUR DHVPX OEBJA QBT WHZCRQ BIRE GUR YNML SBK.");