Basically, you just add generic objects to the array the same as you would any other array value. For example:
<<set $someArray = [ { name: "Object1", ID: 1 }, { name: "Object2", ID: 2 } ]>>
<<set $someArray.push( { name: "Object3", ID: 3, xyz: "ABC" } )>>
And then you could access them like this:
<<print $someArray[0].name>>
and that would display "Object1", since that's the value of .name on the object at index 0 of the array.
You can also have objects which contain other objects like this:
<<set $someObject = { Object1: { ID: 1, val: "example" }, Object2: { ID: 2 } }>>
<<set $someObject.Object3 = { ID: 3, xyz: "ABC" }>>
<<set $someObject["Object number four"] = { ID: 4, abc: "XYZ" }>>
And then you could access them like this:
<<print $someObject.Object1.ID>>
<<set _name = "Object2">>
<<print $someObject[_name].ID>>
The first line would display 1 and the last line would display 2.
It works exactly the same in JavaScript, except you need to change the "$" part into "State.variables." and/or the "_" part into "State.temporary.". So if you wanted a pop-up alert that displayed the value the same way the last line above did, you'd do:
alert(State.variables.someObject[State.temporary.name].ID);
Oh, and you may have guessed based on the above, but if you want arrays within a generic object, then you'd just do something like this:
<<set $someObject = { someArray: [10, 21, 32, 43] }>>
and you could access it like this:
<<print $someObject.someArray[2]>>
and that would display 32.
Hope that helps! :-)
P.S. Technically speaking, arrays are also objects, they're just a specific kind of object.