How to create a 2 dimensional object with string index and loop through results
<p>I have a syntax issue. I've been looking through hundreds of posts about multidimensional objects and arrays and can't find what I'm looking for. I basically need to populate a database with a bunch of presets and am looking for a way to set those in an array (or 2d object) so I can loop through them and insert them to the database.</p>

<p>The data is a simple list of objects and their accessories. i.e:</p>

<pre><code>Door -&gt;   Handle
          Letterbox
          Cat Flap
          Hinges
          Lock
Window -&gt; Sill
          Frame
          Lock
          Handle
</code></pre>

<p>etc.</p>

<p>I then want a function like this (where "items" is the object that holds all the data) that loops through the results and inserts items and accessories:</p>

<pre><code>for (var i = 0; i &lt; items.length; i++) {
    var item = items[i];
    insertItem(item,'','Object');

    for (var b = 0; b &lt; item.length; b++) {
        var accessory = item[b];
        insertItem(item,accessory,'Accessory');
    }
}
</code></pre>

<p>My question is, how would i put my data into an object and would my looping function work to cycle through the data?</p>
