Caesars Cipher - Is my code bad?

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

I just wanted to ask if my is poorly written or how can i improve my code and myself?

  **Your code so far**
function rot13(str) {
let ascii = []

for(let i = 0; i < str.length; i++){
  ascii.push(str.charCodeAt(i))
}

for(let j = 0; j < ascii.length; j++) {
  if(ascii[j] >= 78 ) {
    ascii[j] = String.fromCharCode(ascii[j]-13)
  } else if (ascii[j] < 78 && ascii[j] >= 65){
    ascii[j] = String.fromCharCode(ascii[j]+13)
  } else {
    ascii[j] = String.fromCharCode(ascii[j])
  }
}

return ascii.join("")

}

console.log(rot13(("GUR DHVPX OEBJA SBK WHZCF BIRE GUR YNML QBT.")));
  **Your browser information:**

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

Challenge: JavaScript Algorithms and Data Structures Projects - Caesars Cipher

Link to the challenge:

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