title: What is the best way to change the order of array of objects in javascript
body: <p>What is the easiest way to re-order an array of objects as below.</p>
  
  <p>I want to re-order it based on group value (custom order)</p>
  
  <pre><code>[ { groupValue: 'Corp',
      doclist: { numFound: 259, start: 0, maxScore: 1.1320078, docs: [Object] } },
    { groupValue: 'Phone',
      doclist: { numFound: 7975, start: 0, maxScore: 1.2560269, docs: [Object] } },
    { groupValue: 'Shop',
      doclist: { numFound: 9, start: 0, maxScore: 1.2556685, docs: [Object] } } ]
  </code></pre>
  
  <p>If I pass in argument with the group value, that particular object corresponding to the group value should come up on the top</p>
  
  <p>Something like </p>
  
  <pre><code>function ("Shop",originalArray){
   return newArray;
  }
  </code></pre>
  
  <p>Should return:</p>
  
  <pre><code>    [ { groupValue: 'Shop',
          doclist: { numFound: 9, start: 0, maxScore: 1.2556685, docs: [Object] } },
  { groupValue: 'Corp',
          doclist: { numFound: 259, start: 0, maxScore: 1.1320078, docs: [Object] } },
        { groupValue: 'Phone',
          doclist: { numFound: 7975, start: 0, maxScore: 1.2560269, docs: [Object] } }]
  </code></pre>