Caesars Cipher Code Work, but not suitable

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?");

What does the failing test say?

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

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

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

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

1 Like

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