title: sort outer array based on values in inner array, javascript
body: <p>I have an array with arrays in it, where I want to sort the outer arrays based on values in a specific column in the inner.</p>
  
  <p>I bet that sounded more than a bit confusing, so I'll skip straight to an example.</p>
  
  <p><strong>Initial data:</strong></p>
  
  <pre><code>var data = [
    [
      "row_1-col1",
      "2-row_1-col2",
      "c-row_1-coln"
    ],
    [
      "row_2-col1",
      "1-row_2-col2",
      "b-row_2-coln"
    ],
    [
      "row_m-col1",
      "3-row_m-col2",
      "a-row_m-coln"
    ]
  ];
  </code></pre>
  
  <p><strong>Sort data, based on column with index 1</strong></p>
  
  <pre><code>data.sortFuncOfSomeKind(1);
  </code></pre>
  
  <p>where the object then would look like this;</p>
  
  <pre><code>var data = [
    [
      "row_2-col1",
      "1-row_2-col2",
      "b-row_2-coln"
    ],
    [
      "row_1-col1",
      "2-row_1-col2",
      "c-row_1-coln"
    ],
    [
      "row_m-col1",
      "3-row_m-col2",
      "a-row_m-coln"
    ]
  ];
  </code></pre>
  
  <p><strong>Sort data, based on column with index 2</strong></p>
  
  <pre><code>data.sortFuncOfSomeKind(2);
  </code></pre>
  
  <p>where the object then would look like this;</p>
  
  <pre><code>var data = [
    [
      "row_m-col1",
      "3-row_m-col2",
      "a-row_m-coln"
    ],
    [
      "row_2-col1",
      "1-row_2-col2",
      "b-row_2-coln"
    ],
    [
      "row_1-col1",
      "2-row_1-col2",
      "c-row_1-coln"
    ]
  ];
  </code></pre>
  
  <p><strong>The big Q</strong></p>
  
  <p>Is there an existing solution to this that you know of, or would I have to write one myself? If so, which would be the easiest sort algorithm to use? QuickSort?</p>
  
  <p>_L</p>