title: How to switch two letters in a string
body: <pre><code>var dkey = ""
  function changekey(decryptionkey){
  dkey = decryptionkey
  var Ranint = Math.floor(Math.random() * 25) + 1
  var Ranint2 = Math.floor(Math.random() * 25) + 1
  if(Ranint===Ranint2){
     Ranint2+=1
     if(Ranint2&gt;25){
         Ranint2-=3
     }
  }
  key = key.replace(key.charAt(Ranint),key.charAt(Ranint2))
  } 
  changekey(key)
  alert(key)
  </code></pre>
  
  <p>Say Ranint = 1 and Ranint2 = 2 then key would be
  "BBCDEFGHIJKLMNOPQRSTUVWXYZ"</p>
  
  <p>My question is how I would change the code for the key to result in 
  "BACDEFGHIJKLMNOPQRSTUVWXYZ"</p>