title: FIltering objects by year in Javascript
body: <p>Recently, I sorted array of objects by dates in ascending order and not including empty strings/undefined. I am having trouble creating a filter that will filter this array from a specific year to another. </p>
  
  <p>For example: I have an array called: </p>
  
  <pre><code>var activities = [
    { "title": 'Hiking', "date": '06/28/2012' },
    { "title": 'Shopping', "date": '01/18/2013' },
    { "title": 'Trekking', "date": '02/21/2013' },
    { "title": 'Sleeping', "date": '11/28/2013' },
    { "title": 'Driving', "date": ' ' },
    { "title": 'Running', "date": ' ' },
    { "title": 'Eating', "date": '12/31/2013' },
    { "title": 'Cooking', "date": '11/28/2014' },
    { "title": 'Excersise', "date": '02/21/2014' },
    { "title": 'Sking', "date": '04/04/2014' },
    { "title": 'Travelling', "date": '08/28/2018' }
  ]
  </code></pre>
  
  <p>I want to filter the dates by years 2012-2013. So the result would be:</p>
  
  <pre><code>  { "title": 'Hiking', "date": '06/28/2012' }
    { "title": 'Shopping', "date": '01/18/2013' }
    { "title": 'Trekking', "date": '02/21/2013' }
    { "title": 'Sleeping', "date": '11/28/2013' }
    { "title": 'Eating', "date": '12/31/2013' }
  </code></pre>
  
  <p>I made an attempt, but I am stuck on what to do.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var activities = [
    { "title": 'Hiking', "date": '06/28/2012' },
    { "title": 'Shopping', "date": '01/18/2013' },
    { "title": 'Trekking', "date": '02/21/2013' },
    { "title": 'Sleeping', "date": '11/28/2013' },
    { "title": 'Driving', "date": ' ' },
    { "title": 'Running', "date": ' ' },
    { "title": 'Eating', "date": '12/31/2013' },
    { "title": 'Cooking', "date": '11/28/2014' },
    { "title": 'Excersise', "date": '02/21/2014' },
    { "title": 'Sking', "date": '04/04/2014' },
    { "title": 'Travelling', "date": '08/28/2018' }
  ]
  
  var activitiesData= activities
      .filter(d =&gt; d.date&amp;&amp; d.date!== ' ')
      .map(({ title, date }) =&gt; ({title, date}))
      .sort((a, b) =&gt; new Date(a.date) - new Date(b.date));
  
  console.log(activitiesData)
      </code></pre>
  </div>
  </div>
  </p>