Caesars Cipher help in figure out the problem?

I don’t know where is the problem in my code :’’)

[spoiler]
function rot13(str) { // LBH QVQ VG!
       var Form = {
         "A":"N",
         "B":"O",
         "C":"P",
         "D":"Q",
         "E":"R",
         "F":"S",
         "G":"T",
         "H":"U",
         "I":"V",
         "J":"W",
         "K":"X",
         "L":"Y",
         "M":"Z"

       };
    return arr=str.split("").map(function(x){
           for (let i in Form){
           if (x === i ){
             return  x = Form[i];
           }else if (x === Form[i]){
             return   x = i;
             console.log(x);
           }else{
             return x;
           }
           
 }
  }).join("");

}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
[/spoiler]


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/caesars-cipher

first>you have console after return

second Form[i] are return what? you compare deciphre side.

third why you assign i to x?

four you have there solutions Form[i] this is like Form[‘A’] and you get the N

1 Like

thanks i figured out the problem this code :smile:

function rot13(str) { // LBH QVQ VG!
       var Form = {
         "A":"N",
         "B":"O",
         "C":"P",
         "D":"Q",
         "E":"R",
         "F":"S",
         "G":"T",
         "H":"U",
         "I":"V",
         "J":"W",
         "K":"X",
         "L":"Y",
         "M":"Z"

       };
    return arr=str.split("").map(function(x){
           for (let i in Form){
           if (x === i ){
             return  Form[i];
           }else if (x === Form[i]){
             return    i;
             
           }
           
             
           };
           return x;
           
           
 
  }).join("");

}

// Change the inputs below to test
rot13("SERR PBQR PNZC");

with accident. You have still there unnecessary part. the secondIF
return the lesson where is how to obtain object key and value