javascript sort array double sort
<p>I have an array <code>MyArrayOfItems</code> of <code>Item</code> objects with objects that look like this:</p>

<pre><code>Item
{
  ContainerID: i, // int
  ContainerName: 'SomeName', // string
  ItemID: j, // int
  ItemName: 'SomeOtherName' // string
}
</code></pre>

<p>I want to sort this array so that it's sorted by <code>ContainerID</code> and then by <code>ItemName</code> alphabetically.</p>

<p>I have a custom sort function that so far looks like this:</p>

<pre><code>function CustomSort(a, b) {

  Item1 = a['ContainerID'];
  Item2 = b['ContainerID'];

  return Item1 - Item2;
}

MyArrayOfItems.sort(CustomSort);
</code></pre>

<p>This sorts by ContainerID but how do I then sort by ItemName?</p>

<p>Thanks.</p>
