title: Javascript: How to sort an array of records by values in one of the fields?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1129216/sorting-objects-in-an-array-by-a-field-value-in-javascript">Sorting objects in an array by a field value in JavaScript</a>  </p>
  </blockquote>
  
  
  
  <p>Suppose I have an array of records: <code>[{a:0,b:0},{a:2,b:1},{a:1,b:2}]</code>
  which I wish to sort in descending order of the <code>a</code> field in each record, and alert the sorted records as a new array (ie the new array would be <code>[{a:2,b:1},{a:1,b:2},{a:0,b:0}]</code>) - how would I go about this? I've tried a few approaches but am banging my head against the wall.</p>
  
  <p>Thanks</p>