I have a working answer to the Cipher.
function rot13(str) { // LBH QVQ VG!
let alpha = ['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 newString = "";
str.split(" ").forEach((word) => {
word.split('').forEach((letter) => {
if(!alpha.includes(letter)) {
return newString += letter;
}
let index = alpha.indexOf(letter)-13;
if(index < 0) {
index = 26 + index;
}
newString += alpha[index];
});
newString += " ";
});
console.log(newString)
return newString;
}
// Change the inputs below to test
rot13("SERR PBQR PNZC")
rot13("SERR CVMMN!")
rot13("GUR DHVPX OEBJA SBK WHZCF BIRE GUR YNML QBT.")
rot13("SERR YBIR?")
Any ideas why the test isn’t completing with this? The function calls at the bottom log out correctly.