Data Structures Projects: Caesars Cipher , can not understand what is wrong with my function?

Hello. Can not understan what is wrong with my function. My function returns what is needed, but I can not pass the task

function rot13(str) {
  // LBH QVQ VG!
  let codeStr = str.split("").map(el => {
    let codeNum = el.codePointAt(0);
    if (codeNum >= 65 && codeNum <= 77) {
      return (codeNum += 13);
    } else if (codeNum >= 77) {
      return (codeNum -= 13);
    } else {
      return codeNum;
    }
  });

  let resultStr = codeStr.map(el => String.fromCharCode(el));

  console.log(resultStr.join(""));
  return resultStr;
}

link to quiz: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/caesars-cipher

Hi @Quintis, it’s a simple mistake! Just double check what you’re returning out of the function compared to what you WANT to return out of the function.

My fall - :roll_eyes:

1 Like