" " is turning to "-" when concatenating to string

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

function rot13(str) {
let res = "";
for(let i=0;i<str.length;i++){
  let num = str.charCodeAt(i);
  if(num <= 77 && 65<=num<=90){
    num += 13;
    res += String.fromCharCode(num);
    continue;
  }
  else if(num > 77 && 65<=num<=90){
    num -= 13;
    res += String.fromCharCode(num);
    continue;
  }
  else res += str[i];
}
console.log(res);
return res;
}

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/89.0.4389.128 Safari/537.36.

Challenge: Caesars Cipher

Link to the challenge:

idk why the space is turning to ‘-’? can anyone please tell me

This is not a valid logical conditional

Thank you @JeremyLT, i was not aware of that

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.