title: how to sort array of objects in javascript
body: <p>I want sort array which is shown below by bayid</p>
  
  <p>Array is the array Name</p>
  
  <pre><code>[
   Object { bayid="35",  status=0},
   Object { bayid="1",  status=0},
   Object { bayid="37",  status=0}
  ]
  </code></pre>
  
  <p><code>Array.sort(function(a,b){return b.bayid &gt;a.bayid})</code></p>
  
  <p>I am not sure what is this function returning but i want to write a function which returns the sorted array as shown below</p>
  
  <pre><code>[
   Object { bayid="37",  status=0},
   Object { bayid="35",  status=0},
   Object { bayid="1",  status=0}
  ]
  </code></pre>
  
  <p>how to do it please help</p>