Cannot Crack Caesars Cipher

Greetings Code Fam,

I have been trying to solve my “Cipher” and after debugging some errors it still has not resulted in resolution. Can someone glance my work to see where I am going wrong?

function rot13(str) {
// Object. I will not need to utilize the
// .toUpperCase()
  const caesarCode = 
  {
    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",
    N: "A",
    O: "B",
    P: "C",
    Q: "D",
    R: "E",
    S: "F",
    T: "G",
    U: "H",
    V: "I",
    W: "J",
    X: "K",
    Y: "L",
    Z: "M",
  };



 // If the punctuation is not in the cipher
 // It will not show in decryption
 const readCipher = "";
 const includeThis = (readCipher, /[^:\s?!.:]/g);
   for (let w = 0; w < str.length; w++) {
     if (readCipher += caesarCode[str[w]]);
    }
      return ("" + includeThis || "");
  }


rot13("SERR PBQR PNZC");

Generally you should not put execution logic in inside of an if condition. Can you usay a bit more about what you intent is here?

Hia.

Your plan makes sense to me, but I’m not sure what the if statement is supposed to be doing right now?

Right now you don’t have a condition, you are always executing to code in the ()s

I’m trying to ask you to articulate in words what that condition should be.

Right now you are checking if the entire result string is equal to some syntax I don’t recognize. The syntax should come after a description of what you want.

I am also trying to reference this site:

The only thing is I am not converting to ‘Uppercase’ or juggling multiple variables. Or counting forward or backward in the alphabet. I do not need to do all of those things. I have a fixed offset of 13. I made the ‘Object’ identify with all caps. The tests are all focused as such. I do not need to recognize all punctuation marks just ‘space’ a ’ . ’ and a ’ ? ’ and an ’ ! ’

It all seems so simple and I am overthinking it so much I’m not seeing it.

I don’t really believe in or enjoy helping people replicate code walkthroughs, especially for certification projects, so I can’t really help you here.

The intention with the certification projects is that you write the code. You can get help but it should all be your code, not your version of somebody else’s code.

Reading somebody else’s algorithm is an important but separate skill.