Caesars Cipher Project - feedback welcomed

Hello. I’d be very thankful for any feedback on this project. I got a feeling it could be cleaner and maybe simplier, but not sure how to change it.

Here’s the code:

function rot13(str) {
  let decoded = "";
  for (let i = 0; i < str.length; i++) {
    if (!str[i].match(/[A-Z]/))
     {
      decoded += str[i];
    } else {
      if (str.charCodeAt(i) + 13 > 90) {
        let over = str.charCodeAt(i) + 13 - 90;
        decoded += String.fromCharCode(64 + over);
      } else {
        decoded += String.fromCharCode(str.charCodeAt(i) + 13);
      }
    }
  }
  return decoded;
}

Thank you in advance.

1 Like

Once you have successfully completed the challenge there is nothing wrong with looking at the solutions in the Hints and comparing them to yours. This is a great way to learn. You did the hard work already. Now you can expose yourself to other ideas about how to solve this. That’s how you learn.