title: Undefined is not an object (evaluating myArray.length)
body: <p>I've been working on a program that uses a quick sort algorithm to sort an array of numbers. This is my code:</p>
  
  <pre><code>    var myArray=[8,2,5,6];
  
  function quickSort(myArray)
  {
      if (myArray.length === 0){
          return [];
      }
  
      var left=[];
      var right=[];
      var pivot= myArray[0];
  
      for (var i=1; i&lt;myArray.length; i++){
  
          if (myArray[i]&lt;pivot) {
              left.push(myArray[i]);
  
          }
  
          else {
  
              right.push(myArray[i]);
          }
      }
  
      return quickSort(left).concat(pivot, quickSort(right));
      document.getElementById().innerHTML = quickSort(left).concat(pivot, quickSort(right));
  }
  </code></pre>
  
  <p>And here is my html</p>
  
  <pre><code>&lt;html&gt;
  &lt;h1&gt;QuickSorter&lt;/h1&gt;
  &lt;button onclick="quicksort()"&gt;Quick Sort It!&lt;/button&gt;
  &lt;script src="quicksort.js"&gt; &lt;/script&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The console in safari keeps showing me this :</p>
  
  <pre><code>TypeError: undefined is not an object (evaluating myArray.length)
  </code></pre>
  
  <p>I really don't understand at all why it isn't working. Any help would be appreciated.</p>