Counting and looping through multiple arrays within object
<p>I'm basically just trying to loop through a series of arrays (dynamically created) and output the results in the console. The debugger is telling me that <code>this.allitems[i]</code> is undefined. How do I loop through each array in the allItems object?</p>

<pre><code>var warehouse = {
  allItems: {
    shirts:[],
    shorts:[]
  },

 // Counts how many arrays are in the object 
 countArraysInAllItems: function(obj){
    var size = 0,key;
    for(key in obj){
      if(obj.hasOwnProperty(key)) size++;
    }
    return size;
  },

  // Display the items from the arrays (in no particular order)
  displayItems: function(){
    var allItemsLength = this.countArraysInAllItems(this.allItems);

    for(var i=0; i&lt;allItemsLength; i++){
      var itemSubArray = this.allItems[i];

      for(var j=0; j&lt;itemSubArray.length; j++){
        var itemType = this.itemSubArray[j].itemType;
        var itemName = this.itemSubArray[j].itemName;
        var itemQuantity = this.itemSubArray[j].itemQuantity;

        console.log('Type:' + itemType + '\n' + 
                  'Name: ' + itemName + '\n' +  
                  'Qty:' + itemQuantity);
        }
      }
    }
</code></pre>