title: Array of Objects with sorting on two conditions
body: <p>I have an Array of Object. I need to sort it using two conditions. </p>
  
  <pre><code>[{
  id: 412,
  start_date: 1488479400,
  status: 1
  }, {
  id: 560,
  start_date: 1499451100,
  status: 0
  }, {
  id: 112,
  start_date: 1499091200,
  status: 0
  }, {
  id: 512,
  start_date: 1488474500,
  status: 1
  }, {
  id: 750,
  start_date: 1483473100,
  status: 1
  }, {
  id: 123,
  start_date: 1499106600,
  status: 0
  }, ]
  </code></pre>
  
  <p>I need to sort this using two conditions. </p>
  
  <ol>
  <li>All the object with status 1 should come first</li>
  <li>The Date should be in descending order i.e., Highest date first. </li>
  </ol>
  
  <p>Here's the expected output</p>
  
  <pre><code>[{
  id: 750,
  start_date: 1483473100,
  status: 1
  }, {
  id: 512,
  start_date: 1488474500,
  status: 1
  }, {
  id: 412,
  start_date: 1488479400,
  status: 1
  }, {
  id: 112,
  start_date: 1499091200,
  status: 0
  }, {
  id: 123,
  start_date: 1499106600,
  status: 0
  }, {
  id: 560,
  start_date: 1499451100,
  status: 0
  }, ]
  </code></pre>
  
  <p>What i tried is followed <a href="https://stackoverflow.com/a/18246278/3282633">this answer</a></p>
  
  <p>Assigned the array to data and then</p>
  
  <p><code>data.sort(function(a,b){return a.start_date - b.start_date()});</code></p>
  
  <p>But it didn't sort using the start_date</p>
  
  <p><a href="https://jsfiddle.net/7zpdr43e/" rel="nofollow noreferrer">Here's my Fiddle</a></p>