title: Swapping two items in a javascript array
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/872310/javascript-swap-array-elements">Javascript swap array elements</a>  </p>
  </blockquote>
  
  
  
  <p>I have a array like this:</p>
  
  <pre><code>this.myArray = [0,1,2,3,4,5,6,7,8,9];
  </code></pre>
  
  <p>Now what I want to do is, swap positions of two items give their positions.
  For example, i want to swap item 4 (which is 3) with item 8 (which is 7)
  Which should result in:</p>
  
  <pre><code>this.myArray = [0,1,2,7,4,5,6,3,8,9];
  </code></pre>
  
  <p>How can I achieve this?</p>