JavaScript Algorithms and Data Structures Projects - Caesars Cipher

Tell us what’s happening:

I just need the output to be in a string and I’ve tried can anyone help
Describe your issue in detail here.

Your code so far

function rot13(str) {

 
//str.replace(/[A-Z]/g,string.fromCharcode())


 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].replace(/\n/,(""))
 

// let string = str.toString()
 }
  return;
  
 
}
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

Your switch statement is just console logging the letters.

All letters will be uppercase. Do not transform any non-alphabetic character (i.e. spaces, punctuation), but do pass them on.

You need a way transfer non-alphanumeric characters, especially spaces.

Happy coding.

1 Like

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