title: Use Underscore.js to retrieve top n elements from array ranked by some property
body: <p>I have an array of objects in javascript. Each object is of the form</p>
  
  <pre><code>obj {
      location: "left", // some string
      weight: 1.25 // some real, positive number
  }
  </code></pre>
  
  <p>Let us assume the length of the array is greater than 500.</p>
  
  <p>I want to return a filtered copy of the array where only the top 500 elements as ranked by the <code>weight</code> property are present. In other words, I want the array with objects with the 500 highest <code>weight</code>s</p>
  
  <p>What is the clean way to do this with underscore?</p>