title: Javascript - sort without sort
body: <p>Problem in Javascript</p>
  
  <p>I previously asked this question <a href="https://stackoverflow.com/questions/15612111/javascript-2d-array-sorting-by-numerical-value">Javascript 2D array sorting - by numerical value</a> with a solution provided using the sort function, which I have tried to use without sucsess. Turns out the sort function isn't correctly within the tool I am using, it sorts 5 values and then stops working - and is not working using negative values etc. Spoken to their development team and been told to upgrade - not an option.</p>
  
  <p>Tl:dr - I need to sort with out using the inbuilt sort function.</p>
  
  <p>I have two arrays</p>
  
  <pre><code>values = [1000, 2356, 3456778, 7645748, -2324, 348845.45, -2345666]
  
  labels = ["ValA", "ValB", "ValC", "ValD", "ValE", "ValF", "ValG", "ValH"]
  </code></pre>
  
  <p>These need to be combined to show [1000,ValA, etc] with the largest value appearing first.</p>
  
  <p><strong>Without the inbuilt sort functionality</strong>, I am at a loss on how to proceed. I tried using the Math.Max to cycle through the array, but when I'd combined these two arrays the function stopped working.</p>
  
  <p>I am not sure whether to combine these two individual arrays, or to keep them separate so that the sorting is simpler, remembering the original index and links to the label.</p>
  
  <p>Any thoughts or questions welcome, I am truly stumped and not a developer by trade so sure there is some kind soul out there who maybe able to support me. </p>
  
  <p>Thanks</p>
  
  <p>Expected output </p>
  
  <pre><code>[7645748, ValD]
  [3456778, ValC]
  [348845.45, ValF]
  [2356, ValB]
  [2324, ValE]
  [1000, ValA]
  [-2345666, ValG]
  </code></pre>