title: Javascript in IE8: how to sort array of objects by alphanumeric property
body: <p>I've got an array of Javascript objects that I'd like to cross-compatibly sort by a property that is always a positive integer with an optional single letter at the end.   I'm looking for a solution that works in at least Firefox 3 and Internet Explorer 8.  The closest I've come to such a sort function is the following:</p>
  
  <pre><code>var arrayOfObjects = [{id: '1A', name: 'bar', size: 'big'}, {id: '1C', name: 'bar', size: 'small'}, {id: '1', name: 'foo', size: 'big'}, {id: '1F', name: 'bar', size: 'big'}, {id: '1E', name: 'bar', size: 'big'}, {id: '1B', name: 'bar', size: 'small'}, {id: '1D', name: 'bar', size: 'big'}, {id: '1G', name: 'foo', size: 'small'},  {id: '3', name: 'foo', size: 'small'}, {id: '23', name: 'foo', size: 'small'}, {id: '2', name: 'foo', size: 'small'}, {id: '1010', name: 'foo', size: 'small'}, {id: '23C', name: 'foo', size: 'small'}, {id: '15', name: 'foo', size: 'small'}]
  
  arrayOfObjects.sort(function(a, b){
      return (a.id &lt; b.id ? -1 : a.id == b.id ? 0 : 1);
  });
  </code></pre>
  
  <p>After being so sorted, printing out arrayOfObjects gives: </p>
  
  <p>1, foo, big<br>
  1010, foo, small<br>
  15, foo, small<br>
  1A, bar, big<br>
  1B, bar, small<br>
  1C, bar, small<br>
  1D, bar, big<br>
  1E, bar, big<br>
  1F, bar, big<br>
  1G, foo, small<br>
  2, foo, small<br>
  23, foo, small<br>
  23C, foo, small<br>
  3, foo, small  </p>
  
  <p>However, I would like arrayOfObjects to print out in the order below:</p>
  
  <p>1, foo, big<br>
  1A, bar, big<br>
  1B, bar, small<br>
  1C, bar, small<br>
  1D, bar, big<br>
  1E, bar, big<br>
  1F, bar, big<br>
  1G, foo, small<br>
  2, foo, small<br>
  3, foo, small<br>
  15, foo, small<br>
  23, foo, small<br>
  23C, foo, small<br>
  1010, foo, small  </p>
  
  <p>Given that, how could I fix the above function so that the objects sort by number as primary key and letter as secondary key?  Thanks in advance for any help.</p>