title: Implementing Insert Function
body: <p>I am currently working through Khan Academy's algorithm course, which uses JS to teach fundamental algorithms. I am currently in the process of implementing an insertion sort, but have found a problem.</p>
  
  <p>We are writing a function which takes in an array, index to start from and value, in order to insert a number in the correct ordered position. I have written said function here:</p>
  
  <pre><code>var insert = function(array, rightIndex, value) {
  for (var i = rightIndex; array[i] &gt;= value; i--) {
      array[i+1]=array[i];
      array[i] = value;
  }
  return array;
  };
  </code></pre>
  
  <p>This works fine, and performs as it should, however it does not pass KA's automated marking system. They give guidelines for the code and suggest it be done as such:</p>
  
  <pre><code>for(var ____ = _____; ____ &gt;= ____; ____) {
      array[____+1] = ____;
  }
  ____;
  </code></pre>
  
  <p>Does anyone know how I could reiterate my code to conform to these standards?</p>