Solution
function rot13(str) {
let alph ="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
let conv ="";
let getIndex = num => num+13 >= alph.length ? num+13-alph.length : num+13;
for(let i=0; i<str.length; i++){
if(alph.indexOf(str[i])!=-1){
conv=conv.concat(alph[getIndex(alph.indexOf(str[i]))]);
}else{
conv=conv.concat(str[i])
}
}
console.log(conv);
return conv;
}
rot13("SERR PBQR PNZC");