title: Sorting an array in Javascript based on predefined order
body: <p>I have an array:</p>
  
  <pre><code>var homes = [{
      "h_id": "3",
      "city": "Dallas",
      "state": "TX",
      "zip": "75201",
      "price": "162500"
  }, {
      "h_id": "4",
      "city": "Bevery Hills",
      "state": "CA",
      "zip": "90210",
      "price": "319250"
  }, {
      "h_id": "5",
      "city": "New York",
      "state": "NY",
      "zip": "00010",
      "price": "962500"
  }];
  </code></pre>
  
  <p>And would like to sort it based on the following order</p>
  
  <pre><code>cities = ['New York', 'Dallas', 'Bevery Hills']
  </code></pre>
  
  <p>What's the best way to achieve it?</p>