SOLVED : Adding and retrieving instantiated objects from Array

I've looked through many posts found on forum and here and still have not been able to get anything functional.

I have objects that are being instantiated from functions that are called elsewhere in the script. There are 4 different prefab shapes that are instantiated from a switch/case in this spawn function. At the same time, I have another function that runs that spawns container prefabs that match whatever prefab shape is spawned from that other function (confusing eh?).

The main problem is that when the spawnShape function runs it spawns the corresponding container right away. I don't want the container prefab changing right away. Currently, the moment the shape is spawned, the container spawns to latest shape. What I've been attempting is it to cache/store the spawns of the container prefabs in an array as to not switch/spawn the container to the last shape spawned, but spawn incrementally to those before the latest. I have been unsuccessful storing the instantiated objects in an array. I've attempted the many examples of storing gameobjects in arrays that I have come across... but alas, no dice.

It's either hard to explain, or I'm doing a horrible job of explaining it. My apologies if that's the case. Any input is greatly appreciated.

Example (hopefully easy to follow):

    containerArray = Array();

    function Start(){
         containerArray.length = 10;  

    function spawnShapes(){
         var randomPrefab : int = Random.Range(1,5);
         switch (randomPrefab) {
              case 1: prefabToSpawn = shape1Prefab; fillContainerArray(container1Prefab); break;
              case 2: prefabToSpawn = shape2Prefab; fillContainerArray(container2Prefab); break;
              case 3: prefabToSpawn = shape3Prefab; fillContainerArray(container3Prefab); break;
              case 4: prefabToSpawn = shape4Prefab; fillContainerArray(container4Prefab); break;
          var randomRotation : int = (360 - (Random.Range(1,8) * 45));
          var spawnNum : int = Random.Range(1,7);
          var spawnPoint = GameObject.Find("SpawnPoint"+ spawnNum);
          Instantiate (prefabToSpawn, spawnPoint.transform.position, Quaternion.Euler(0,0,randomRotation));

    function spawnContainers(){
         var oldContainer = GameObject.FindWithTag("container");

             if(oldContainer != null) {
                  Instantiate(containerArray[0], oldContainer.transform.position, Quaternion.Euler(0,0,0));
                     Instantiate(containerArray[0], Vector3(0,0,10), Quaternion.Euler(0,0,0));

     function fillContainerArray( x : Transform){
         for(var i=0; i<containerArray.length; i++){
              if(containerArray *== null){*
 _containerArray *= x;*_
 _*function shiftArray(){*_
 _*for(var i=0; i<9; i++){*_
 <em>_containerArray *= containerArray[i+1];*_</em>
<em>_*<p>UPDATE: This is the functional code now working.</p>*_</em>

Are you using unity arrays or javascript arrays? Unity arrays are faster but are fixed while javascript arrays has all the standard array functions like push and shift.