We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9c726a7 commit f3846fbCopy full SHA for f3846fb
Cipher/rot13.js
@@ -0,0 +1,7 @@
1
+function rot13(str) {
2
+ var input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
3
+ var output = "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm";
4
+ var index = (x) => input.indexOf(x);
5
+ var translate = (x) => (index(x) > -1 ? output[index(x)] : x);
6
+ return str.split("").map(translate).join("");
7
+}
0 commit comments