Caesars Cipher - test dont pass even though code is working

Tell us what’s happening:

my code is given the correct results per the console logs but still tests dont pass

Your code so far


function rot13(str) { // LBH QVQ VG!
  let arr = str.split("");
  let reg = /[a-z]/i;
  let result = '';
  for(let i=0;i<arr.length;i++){
      if(arr[i].match(reg)){
        
        let index = arr[i].charCodeAt(0);
        let howmuch =  90-index;
        let decodVael = index+13;
        if(howmuch <13){
            decodVael = 64+(13-howmuch);
        }
        let decoded = String.fromCharCode(decodVael);
        //   console.log("given",arr[i],"decode",decoded);
        result+= decoded;
      }else{
          result+= arr[i];
      }
  }
  console.log(result);
  return str;
}

// Change the inputs below to test
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/67.0.3396.87 Safari/537.36.

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

Hi guyinster,

You are almost there! 99% correct!

Question is… what are you returning?

return str;

str returns “SERR PBQR PNZC”

The value of result is FREE CODE CAMP

Happy Coding!

thanks dont know how i missed that