Why my solution have difrent logic then other in fcc project

all my solutions are like not very similaire to others dev…? am i right or wrong
?

this an expl :

function rot13(str) {
 var x = ['A','B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y','Z']
        var z = ['N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y','Z','A','B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M']
        var v = '';
        var y = str ;
      console.log(y.length) 
     for(var i =0;i<=y.length;i++){
        if (y[i]==' ' || y[i]=='!' || y[i]=='?' || y[i]=='.' ){
        v=v+y[i]
    }
        for (var j=0; j<z.length;j++){
      if (y[i] == z[j] ){
                 v=v+x[j]  
                console.log(v)
                
               }
       
          }
     }
  return  v;
}

rot13("SERR PBQR PNZC");

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

Please use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks are not single quotes.

markdown_Forums

1 Like

because you think differently?

there is not a single correct way to write an algorithm, if your code works it is the first awesome step

1 Like

thank you for the tips

thank you i thought it wasn’t enough , cuz i used long code…btw i’m just at the beginning of the curriculum