Caesars Cipher questions

I don’t know what is wrong with “?” and why it is mix up with “Y” in my code. Help me, please

function rot13(str) { // LBH QVQ VG!
  var ass;
  var stre = str.charCodeAt(0);
  var abr;
  var arra = [];
  var arraye;
  for (var i = 0; i < str.length; i++) {
  stre = str.charCodeAt(i);
    
  if (stre>= 78 && stre <= 90) {
    stre = stre-13;
    abr = String.fromCharCode(stre);
    arra.push(abr);
  }
  else if (stre >= 60 && stre <= 77) {
    stre+= 13;
    abr = String.fromCharCode(stre);
    arra.push(abr);
  }
  else if (stre < 65 || stre > 90) {
    stre = stre;
    abr = String.fromCharCode(stre);
    arra.push(abr);
  }
  arraye = arra.join('');
   
  
  
}
  return arraye;
}
// Change the inputs below to test
rot13("SERR YBIR?"); 

I got it.
stre >= 65 not 60

1 Like