title: Sorting objects based on property value in D3
body: <p>I have a array of objects for use in D3 e.g</p>
  
  <pre><code>var cities = [
    { city: "London", country: "United Kingdom", index: 280 },
    { city: "Geneva", country: "Switzerland", index: 259 },
    { city: "New York City", country: "United States", index: 237 },
    { city: "Singapore", country: "Singapore", index: 228 },
    { city: "Paris", country: "France", index: 219 },
    { city: "San Francisco", country: "United States", index: 218 },
    { city: "Copenhagen", country: "Denmark", index: 217 },
    { city: "Sydney", country: "Australia", index: 215 },
    { city: "Hong Kong", country: "Hong Kong", index: 214 },
    { city: "Brisbane", country: "Australia", index: 208 }
  }
  </code></pre>
  
  <p>I would like to order the objects in ascending order based on their cities.index property. So that I can display them as such in <code>D3.js</code>. Im sure there is a way of doing this in D3 but I am yet to figure it out when dealing with an array of objects.</p>
  
  <p>Any help?</p>