Skip to content

Instantly share code, notes, and snippets.

@SoftwareDevPro
Created May 24, 2019 00:31
Show Gist options
  • Save SoftwareDevPro/4a3f4de98987b902d109395cc55abc40 to your computer and use it in GitHub Desktop.
Save SoftwareDevPro/4a3f4de98987b902d109395cc55abc40 to your computer and use it in GitHub Desktop.
Implementation of Caesars Cipher for Free Code Camp
{"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