title: How do you sort an array of objects properly?
body: <p>I seem to be having a little issue getting an array of objects to sort properly.</p>
  
  <p>For example, let's say I have the following:</p>
  
  <pre><code>var items = [
      {id: '1', itn: '1'},
      {id: '2', itn: '10P'},
      {id: '3', itn: '2'},
      {id: '4', itn: '3'}
  ];
  </code></pre>
  
  <p>I need to sort this array based on the value in "itn." However, when I run the function below I get it listed as 1, 10P, 2, 3 instead of 1, 2, 3, 10P.</p>
  
  <pre><code>userData.sort(function (a, b) {
      return (b.itn &gt; a.itn) ? -1 : (b.itn &lt; a.itn) ? 1 : 0;
  });
  </code></pre>
  
  <p>I'm a bit stuck in how to go forward with this and am also unsure what kind of keywords to search for to get the correct guidance. Any help is appreciated! </p>
  
  <p>Thanks in advance.</p>