How do I make the ascii values start over?

I thought I had it with this but realize if the letter is ‘Z’ then it needs to loop around to the starting ascii values of ‘A’.

function rot13(str) {
  let shifted = []; 
  console.log(str.charCodeAt(0))
  for (let i=0; i<str.length; i++){
        if(str.charCodeAt(i) > 64) {
          shifted.push(String.fromCharCode(str.charCodeAt(i) + 13)); 
      }
      else {
        shifted.push(str[i]); 
      
      }
    }
      shifted = shifted.join("");
      console.log(shifted);
      return shifted;
}

rot13("SERR PBQR PNZC");

If you come up with a solution to your question I would suggest you post it instead of just deleting your post. Might be helpful to other campers. Just a suggestion though.

function rot13(str) {
    let shifted = []; 
    for (let i=0; i<str.length; i++) {
          if(str.charCodeAt(i) > 64) {
            if(str.charCodeAt(i) > 77) {
              shifted.push(String.fromCharCode(str.charCodeAt(i) + 13 - 26));
            }
            else if(str.charCodeAt(i) <= 77) {
              shifted.push(String.fromCharCode(str.charCodeAt(i) + 13));
            }
        }
            else {
              shifted.push(str[i]); 
            }
      }
        shifted = shifted.join("");
        console.log(shifted);
        return shifted;
  }
  
  rot13("SERR PBQR PNZC");

I have blurred your code to avoid spoilers.

I just meant the solution to the specific question you had. Not that you should post the solution to the challenge. Try to explain it without spoiling. :wink:

Edit: If you do post solution code use the [spoiler] [/spoiler] tags. Although we would prefer not having full solutions posted.