title: jQuery Javascript Group Years by Decades
body: <p>I have the below which loops through each div and returns the year that each div represents, but what I'd like to do is group the returned years into arrays of the decades. I'm not quite sure how to do that and was hoping someone could help with this.</p>
  
  <pre><code>&lt;div class="timeline-events timeline-year-1994"&gt;This is 1994&lt;div&gt;
  &lt;div class="timeline-events timeline-year-1997"&gt;This is 1997&lt;div&gt;
  &lt;div class="timeline-events timeline-year-2001"&gt;This is 2001&lt;div&gt;
  &lt;div class="timeline-events timeline-year-2003"&gt;This is 2003&lt;div&gt;
  &lt;div class="timeline-events timeline-year-2012"&gt;This is 2012&lt;div&gt;
  
  
  $('.timeline-events').each(function(){
      console.log(this.className.match(/timeline-year-(\d+)?/)[1]);
  });
  </code></pre>
  
  <p><a href="http://jsfiddle.net/mv51tu9z/" rel="nofollow">jsFiddle</a></p>