Created
May 24, 2019 00:31
-
-
Save SoftwareDevPro/4a3f4de98987b902d109395cc55abc40 to your computer and use it in GitHub Desktop.
Implementation of Caesars Cipher for Free Code Camp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"index.js":"function rot13(str) { // LBH QVQ VG!\n return str.split('')\n .map.call(str, function(char) {\n \n let x = char.charCodeAt(0);\n \n if (x < 65 || x > 90) { \n return String.fromCharCode(x);\n } else if (x < 78) { \n return String.fromCharCode(x + 13); \n }\n \n return String.fromCharCode(x - 13);\n }).join(''); \n}\n\n// Change the inputs below to test\nrot13(\"SERR PBQR PNZC\");"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment