We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 71d8bfe commit f3108c5Copy full SHA for f3108c5
rot13.js
@@ -0,0 +1,22 @@
1
+function rot13(str) { // LBH QVQ VG!
2
+ var cadenaLegible=[];
3
+ var suma=0;
4
+ for(var cont=0; cont < str.length; cont++){
5
+ //console.log("Entrada: ")
6
+ if(str[cont]>= "A" && str[cont]<="M"){
7
+ suma = 13;
8
+ }else if (str[cont]>"M" && str[cont]<="Z"){
9
+ suma = -13;
10
+ }
11
+ if (str[cont]>="A" && str[cont]<="Z"){
12
+ cadenaLegible.push(String.fromCharCode(str.charCodeAt(cont)+suma));
13
+ }else{
14
+ cadenaLegible.push(str[cont]);
15
16
17
+ console.log(cadenaLegible);
18
+ return cadenaLegible.join("");
19
+}
20
+
21
+// Change the inputs below to test
22
+rot13("SERR PBQR PNZC");
0 commit comments