Caesars Cipher, why don't you want me?

Tell us what’s happening:

Hi everyone,
I’m trying to wrap up the cipher problem.
As far as I’m concerned my solution does work, but isn’t validated by the site.
At first I thought that quotes must be returned as part of the answer,
So I tried that, to no avail.
I get all the right results but for some reason my solution does not pass validation
I also didn’t use ES6 and cannot see any syntax errors. :thinking:
Can someone help?? thank you so much

Your code so far


var result = [];
function rot13(str){
  var allCaps = str.toUpperCase();
  allCaps = allCaps.split('');
  var l = allCaps.length;

  for(var i = 0; i < l; i++){
    if (allCaps[i].match(/[A-Z]/) !== null){
      for(var j = 0; j < paires.length; j++){
          if(allCaps[i] == paires[j][0]){
          result.push( paires[j][1]);
  var resultat = "\"" + result.join('') + "\"";
  return  resultat;
rot13("SERR YBIR?");

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0.

Link to the challenge:

Your code contains global variables that are changed each time the function is run. This means that after each test completes, subsequent tests start with the new value. To fix this, make sure your function doesn’t change any global variables, and declare/assign variables within the function if they need to be changed.


var myGlobal = [1];
function returnGlobal(arg) {
  return myGlobal;
} // unreliable - array gets longer each time the function is run

function returnLocal(arg) {
  var myLocal = [1];
  return myLocal;
} // reliable - always returns an array of length 2