My code should work, but it is counting it as wrong

My code should work, but it is counting it as wrong
0

Tell us what’s happening:

I am doing the challenge to decode ROT13 Chiper, it looks like my code should work but all of the tests all fail, can anyone see what is going on?

Your code so far

function rot13(str) { 

newstring = str.split("");
for(i = 0; i < str.length; i++) {
  if(str.charCodeAt(i) < 64) {
    continue;
  }
  
  else if(str.charCodeAt(i) < 78 && str.charCodeAt(i > 64)) {
    newcode = String.fromCharCode(str.charCodeAt(i) + 13);
    newstring[i] = newcode;
  } else {
    newcode = String.fromCharCode(str.charCodeAt(i) - 13);
    newstring[i] = newcode;
  }
 
}
str = newstring.join("");
console.log(str);
str = str.replace(/[']/g, "")
return str;


}


// Change the inputs below to test
rot13("GUR DHVPX OEBJA SBK WHZCF BIRE GUR YNML QBT.");





Challenge: Caesars Cipher

Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/caesars-cipher

What output do you get when you run your code against the test string provided?

I do my code on repl.it and port it over and every situation works.
Ex:
GUR DHVPX OEBJA SBK WHZCF BIRE GUR YNML QBT. => returns THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.

Alrighty, what does the console say when you run the tests?

Do you mean on freeCodeCamp? It says

running tests

rot13("SERR PBQR PNZC")

should decode to

FREE CODE CAMP

rot13("SERR CVMMN!")

should decode to

FREE PIZZA!

rot13("SERR YBIR?")

should decode to

FREE LOVE?

rot13("GUR DHVPX OEBJA SBK WHZCF BIRE GUR YNML QBT.")

should decode to

THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.

// tests completed

Make sure you are declaring your variables. I see 3 undeclared variables.

You are not declaring any of your variables with var, let, or const. When you do that, all variables are created as global variables. If you recall the lessons on scoping, you’ll know why that’s a bad idea. freeCodeCamp runs all JavaScript in strict mode. I suggest that you always use "use strict"in your code outside of freeCodeCamp as well.

FYI - There is a current bug in the curriculum which does not show an error for this situation, but a PR has been created and is currently being reviewed which will allow the user to see why the code is failing.

Thanks for the help!