JavaScript Algorithms and Data Structures Projects - Caesars Cipher

Tell us what’s happening:
Describe your issue in detail here.
syntax error or something

   **Your code so far**
function rot13(str) {
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
console.log(alphabet.length);
let newStr = '';

for (let i = 0; i < str.length; i++)

let index = alphabet.indexOf(str[i])
 if (index == -1){
   newStr += str[i]
} else{
let newIndex = (index + 13) % 26;
newStr += alphabet[newIndex]
}

console.log(alphabet.indexOf(str[i])); 


 
 console.log(alphabet.indexof(str[1]));
 return newstr;
}

console.log(rot13("SERR PBQR PNZC"));
   **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.81 Safari/537.36

Challenge: JavaScript Algorithms and Data Structures Projects - Caesars Cipher

Link to the challenge:

Yes, you have a syntax error. Can you be more specific?

You should look at the results from applying the formatter to your code. You aren’t guarding your for loop body with {}s.

image

You also have two typos with capitalization in variable names.

Your for loop is missing opening { and a closing }.