Create a new object every 5 elements
<p>I'm going through each div with a class name and throwing the html into a key/value object. My issue is that to go further than what I have now, one big object will not cut it. I need to either put every 5 into a different object, or do something similar to .slice() to break it down afterwards. I'm lost because, as much as this would be easy to do if I knew how many upfront, I'd like to make this as dynamic as possible. A user may have 27 .example div's vs the 3 I have below. It's in an object now and not an array as the key/value object plays nicer with dojo charting, and a few other things I'm trying to do. As an over simplified example:</p>

<pre><code>    //HTML
    &lt;div class="example"&gt;
        &lt;div class="title"&gt;&lt;/div&gt;
        &lt;div class="definition"&gt;&lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="example"&gt;
        &lt;div class="title"&gt;&lt;/div&gt;
        &lt;div class="definition"&gt;&lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="example"&gt;
        &lt;div class="title"&gt;&lt;/div&gt;
        &lt;div class="definition"&gt;&lt;/div&gt;
    &lt;/div&gt;

    //JS
    var titles = {};
    $('.example').each(function(index) {    
        var exampleTitle = $(this).find('.title').html();
        var exampleDef = $(this).find('.definition').html();
        titles[exampleTitle] = exampleDef;
    });
</code></pre>

<p>In my mind, instead of titles = {}, I'd like to push every 5 into a seperate object. </p>

<pre><code>    //...
    titles2= {}; 
    titles3={};
    etc
</code></pre>

<p>without hard coding the amount in the code beforehand.</p>

<p>(i.e. I don't want to say if(index>5) and specify titles2 in the code, the user may have many more than that, and hard-coding multiples of 5 up to whatever arbitrary number I can think of supporting doesn't seem very efficient.)</p>

<p>Or a way to use multiples of 5 similar to .slice(). </p>

<pre><code>titles.slice(0,5); //obviously does not work on objects, just as an example
</code></pre>

<p>Any thoughts?</p>
