Caesars Cipher - How to concatenate strings inside loop?

How can I concatenate the strings inside a for loop to solve the Cipher?

I tried to do as it follows, but my result var just show the first letter. What am I doing wrong?

Your code so far

function rot13(str) { // LBH QVQ VG!
  var result = "";
  
  for (i = 0; i<str.length; i++){
    if (str[i].charCodeAt(0)>=65 && str[i].charCodeAt(0)<78){
    result += String.fromCharCode(str[i].charCodeAt(0)+13);
    }
    else if (str[i].charCodeAt(0)>=78 && str[i]<=90){
    result += String.fromCharCode(str[i].charCodeAt(0)-13);
  }
    else{
      result += str[i];
    }
  return result;
}}

// Change the inputs below to test
rot13("SERR PBQR PNZC");

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/challenges/caesars-cipher

Your return is inside your for loop.