I have an issue with displaying an array contains the values that have been saved during each loop.

This is the simple code illustrating what i mean

```
$('.photo').each(function(){
   width_array.push($(this).width()); 
});

// when each loop is complete
for(var i =0,i<$('.photo').length,i++){
   total_width += width_array[i];
}

```

The problem here is the for loop starts before finishing of each loop.

How to solve this issue ?