Output correct on every other console, yet I am unable to pass test

Tell us what’s happening:
I have solved ROT13 and as you can see by the output, the code works the way it is supposed to however I am unable to pass the test. Please could anyone explain as to why this is happening?

   **Your code so far**

function replacing(str){
let strAm = "ABCDEFGHIJKLMNOPQRSTUVWXYZ -_.&?!@ #/";
let strNz = "NOPQRSTUVWXYZABCDEFGHIJKLM -_.&?!@ #/";
  let rot13 = '';
  for (let i = 0; i < str.length; i++){
    if (strAm.includes(str.charAt(i))){
      rot13 += str.charAt(i).replace(str.charAt(i), strNz[strAm.indexOf(str.charAt(i))]);
    }
  }
  return rot13;
}
console.log(replacing("GUR DHVPX OEBJA SBK WHZCF BIRE GUR YNML QBT."));
   **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36 Edg/95.0.1020.53

Challenge: Caesars Cipher

Link to the challenge:

Thank you. I found the problem. Actually, I had named my function “replacing(str)”. But the function that the test was looking for was “rot13(str)”. I just changed “replacing(str)” to “rot13(str)” and it worked.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.