JavaScript Algorithms and Data Structures Projects - Caesars Cipher

Tell us what’s happening: Its working but the console brings the answer not in a array so it does not pass the test can someone tell how can i make it string again

Describe your issue in detail here.

Your code so far

function rot13(str) {

  
  const fr = ("ABCDEFGHIJKLMNOPQRSTUVWXYZ")



 for(let i = 0;i < str.length;i++){
 switch(fr){
    case "A":
    console.log("N")
    break;
    case "B":
    console.log("O")
    break;
    case "C":
 console.log("P")
  break;
  case "D":
  console.log("Q")
  break;
  case "E":
  console.log("R")
  break;
   case "F":
    console.log("S")
   break;
case "G":
console.log("T")
break;
case "H":
console.log("U")
break;
case "I":
console.log("V")
break;
case "J":
console.log("W")
break;
case "K":
console.log("X")
break;
case "L":
console.log("Y")
break;
case "M":
console.log("Z")
break;
case "N":
console.log("A")
break;
case "O":
console.log("B")
break;
case "P":
console.log("C")
break;
case "Q":
console.log("D")
break;
case "R":
console.log("E")
break;
case "S":
console.log("F")
break;
case "T":
console.log("G")
break;
case "U":
console.log("H")
break;
case "V":
console.log("I")
break;
case "W":
console.log("J")
break;
case "X":
console.log("K")
break;
case "Y":
console.log("L")
break;
case "Z":
console.log("M")
break;
 
 }
 let fr = str[i]
 }
 
 return str = ("");
 
 
  
}

rot13("SERR PBQR PNZC");

Your browser information:

User Agent is: Mozilla/5.0 (iPhone; CPU iPhone OS 17_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3.1 Mobile/15E148 Safari/604.1

Challenge Information:

JavaScript Algorithms and Data Structures Projects - Caesars Cipher

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

HI @h81371417

Use the method you learnt in Functional Programming.

Happy coding

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.