This code is working but non-alphabetic characters are removed. Someone help please.
function rot13(str) { // LBH QVQ VG!
var strUpper = str.toUpperCase();
var res, i;
var final = "";
for(i=0; i < strUpper.length; i++){
res = String.charCodeAt(strUpper[i]);
if (res>=65 && res<=77){
res+=13;
final += String.fromCharCode(res);
}
else if (res>=78 && res<=90){
res-=13;
final += String.fromCharCode(res);}
}
return final;
}
// Change the inputs below to test
rot13("LBH QVQ ?VG");