Caesars Cipher Code Work, but not suitable

Caesars Cipher Code Work, but not suitable
0.0 0

#1

Hi! Why is my code not suitable?

Your code so far

  var stringArr = str.split(' ');
  var temp = '';
    
   for(i = 0; i < stringArr.length; i++){
     for(j = 0; j < stringArr[i].length; j++){
       if(stringArr[i][j].charCodeAt() == 46 || stringArr[i][j].charCodeAt() == 33 || stringArr[i][j].charCodeAt() == 63){
        
         temp += stringArr[i][j];
         
       } else if(stringArr[i][j].charCodeAt() >= 65 && stringArr[i][j].charCodeAt() <= 77){
             temp += String.fromCharCode(stringArr[i][j].charCodeAt()+13);
         }  else {
            temp += String.fromCharCode(stringArr[i][j].charCodeAt()-13);
         }
       }
      temp += ' ';
   }
  
  return temp;
}

// Change the inputs below to test
rot13("SERR YBIR?");

#2

What does the failing test say?


#3

Decodes everything correctly, but the task is not considered completed.


#4

Then there is a test that is marked as failed. What does that test say?


#5

%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA


#6

Are you adding a space to the end of every string?


#7

Put the following console.log statement on the line before your return temp, and look at your browser’s console (Ctrl+Shft+J in Chrome) and check if there is an extra character that should not be in the string that is to be returned.

console.log(temp);

#8

Thanks, did not notice the elementary. temp + = ‘’ ";