# Nested arrays and objects - setting up

**URL:** <https://forum.kirupa.com/t/nested-arrays-and-objects-setting-up/327880>\
**Category:** Uncategorized\
**Created:** [April 3, 2012, 12:48pm UTC](https://forum.kirupa.com/t/nested-arrays-and-objects-setting-up/327880 "2012-04-03T12:48:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeancnicolas](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@jeancnicolas](https://forum.kirupa.com/u/jeancnicolas)\
**Post date:** [April 3, 2012, 12:48pm UTC](https://forum.kirupa.com/t/nested-arrays-and-objects-setting-up/327880/1 "2012-04-03T12:48:13Z")

</div>

Hi there… I’m having some defining problems. I have also been looking at fastest shorthand for object and array creation.  
Unfortunately my example doesnt work, but all I want is to loop through and set an object each time into an array, then when the loop is complete, add this array of objects to the master array … to the code boys:

```auto

var master = [];
var nest = []; // for the loop
for(var i=0;i<5;i++){ 
  var obj ={ index:i }; // create object
  nest* = obj;
  if(i==4) master[0] = nest;
}
trace(master[0][3].index); // answer should be 4

```

can you help me out? … I intend to make this more complex which is why I need the master and nest arrays.
