Just wondering if anyone has any advice or feedback for me on this project. Is this a good solution or is there anything that could have been shortened ? Any advice or thoughts are appreciated thanks.
function rot13(str) {
let rot = str.split('');
let ciph = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
let cipher = [];
for(let i = ciph.length-1; i >= 0; i--) {
cipher.push(ciph[i])
};
for(let i = 0; i < rot.length; i++) {
let holder = []
if(ciph.indexOf(rot[i]) - 13 > -1) {
holder = ciph.indexOf(rot[i]) - 13;
rot[i] = ciph[holder]
} else if(cipher.indexOf(rot[i]) - 13 > -1) {
holder = cipher.indexOf(rot[i]) - 13;
rot[i] = cipher[holder]
};
};
return rot.join('')
};
rot13("SERR PBQR PNZC");