title: Sort array of objects by booleans, then by numbers (javascript)
body: <p>I have an array of objects, and I would like to sort them following these two rules (in order of priority):</p>
  
  <p>The objets whose "departeYet" property is true must be at the beginning
  The objects must then be sorted in numerical order (the "number" property)</p>
  
  <p>This would be ok:</p>
  
  <ul>
  <li>true : 005</li>
  <li>true : 007</li>
  <li>true : 027</li>
  <li>false: 009</li>
  <li>false: 020</li>
  </ul>
  
  <p>This is the structure of the part of the objects that interests us:</p>
  
  <pre><code>var notSortedData = {
                          number: number, // it's a string
                          departedYet: scheduled_date, // true or false
                      }
  
                      sortedTrains.push(notSortedData);
  </code></pre>
  
  <p>So, notSortedData is pushed in sortedTrains via a for loop.</p>
  
  <p>Then, I need to sort it:</p>
  
  <pre><code>sortedTrains.sort(function(a, b) {
          // sorting algorithm here
      });
  </code></pre>
  
  <p>What should I do? Thanks.</p>