It's been awhile since I worked with objects so I need to refresh my memory. What I need help with is how to create an object in an each loop with several properties. Below is what I've tried so far but that's obviously not correct.
var imgs = {},
i = 0;
$('.img').each(function() {
i++;
imgs['img' + i]['src'] = src; // doesn't work
// imgs['img' + i] = src; <- works but I want several properties for every image.
});
desired output:
imgs: {
img1: {
src: 'http://...',
otherProp: '...'
},
img2: {
src: 'http://...',
otherProp: '...'
},
and so on...
}