title: JavaScript grouping array with age group and find largest date
body: <p>I am trying to implement something like for each age group, I wanted to find the largest date, and then compare with today's date, get the date differences and store into another separate array. Here is some sample input:</p>
  
  <pre><code>//removed
  </code></pre>
  
  <p>I sorted the array into ascending order:</p>
  
  <pre><code>frequentarr.sort(function(a, b) {
      da = new Date(a.date);
      db = new Date(b.date);
      if (da == db) {
          return 0;
      }
      return da &gt; db ? 1 : -1;
  });
  console.log(frequentarr);
  </code></pre>
  
  <p>My age group array:</p>
  
  <pre><code>var ageGroup = ['&gt;=80', '70-79', '60-69', '50-59', '40-49', '30-39', '20-29', '10-19', '0-9'];
  </code></pre>
  
  <p>I not sure how to actually group the account according to age group, and then for each age group, find the largest date. After that, compare with today's date to find the date differences.</p>
  
  <p>Any ideas? Thanks!</p>