Tell us what’s happening:
Describe your issue in detail here.
I have tried my code on the editor many times and it doesn’t seem to work. I tried to troubleshoot it with console.log but it returns, what seems to me, the correct solution. Could someone please tell me what is the problem?
**Your code so far**
function rot13(str) {
var ans = '';
function de_code(boi) {
let num = 13;
boi.toUpperCase();
const theAlphabet = 'abcdefghijklmnopqrstuvwxyz';
let index = theAlphabet.toUpperCase().indexOf(boi);
let index_Num = (index + num)%26;
if(theAlphabet.toUpperCase().includes(boi)) {
return theAlphabet.toUpperCase()[index_Num]
}else {
return " ";
}
}
for(let i = 0; i < str.length; i++) {
console.log(de_code(str[i]))
}
}
rot13("SERR PBQR PNZC");
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36
Challenge: JavaScript Algorithms and Data Structures Projects - Caesars Cipher
Link to the challenge: