title: Selection Sort in JavaScript
body: <pre><code>function newsort(arr, left, right){    
  
  for(var i= left; i &lt; right; ++i){
      var min = i;
      for (var j = i; j &lt; right; ++j){
          if (arr[min] &gt; arr[j]){
          min = j;
          }
      }
  
  var temp = arr[min];
  arr[min] = arr[i];
  arr[i] = temp;  
  
  }
  return arr;
  </code></pre>
  
  <p>}</p>
  
  <pre><code>var arr = [3,5,66,78,23,44,11,32,58];
  alert(newsort(arr, arr.length, 0));
  </code></pre>
  
  <p>Above is the code for a function that I have written. I am still very new to JS, and as a result get confused at times when it comes to syntax. I currently just return the original array, but am trying to do the selection sort, the right/left/mid type.....I can't really tell what is going on at the moment. I am simply trying to sort and then return the array.</p>
  
  <p>Anyone out there able to point me in the right direction?</p>
  
  <p>thanks.....</p>