Need help regarding building logic, adding properties to object
<p>I have an images array in which there are number of images. Not fixed, may be one or two or 8. When i have fixed number of images then i was using the code something like this</p>

<pre><code>var details = {

    image1: {
        position: 0,
        title: $slideDiv.children().eq(0).attr("alt")
    },
    image2: {
        position: -400,
        title: $slideDiv.children().eq(1).attr("alt")
    },
    image3: {
        position: -800,
        title: $slideDiv.children().eq(2).attr("alt")
    },
    image4: {
        position: -1200,
        title: $slideDiv.children().eq(3).attr("alt")
    },
    image5: {
        position: -1600,
        title: $slideDiv.children().eq(4).attr("alt")
    }

}; //end of var details
</code></pre>

<p>But now i have images in array. I want that details object has added images in it equal to number of images in the array. I tried something like this</p>

<pre><code>var details = {};
var position = 0;
images.each(function(index){
    details.("image" + index) : {
        position: position,
        title: $slideDiv.children().eq(index).attr("alt")
    }

    position += -400;

}) ; //end of .each()
</code></pre>

<p>The logic that i am trying to make is if i have two images in the images array the it should become something like this</p>

<pre><code>var details = {
    image1: {
        position: 0,
        title: $slideDiv.children().eq(1).attr("alt")
    },
    image2: {
        position: -400,
        title: $slideDiv.children().eq(2).attr("alt")
    }

}
</code></pre>

<p>but this is not working. Of course my syntax is wrong</p>

<pre><code>details.("image" + index) : {..}
</code></pre>

<p>How can i do this?</p>

<p>Thanks</p>
