title: Sort multidimensional JSON array
body: <p>I have following array from facebook graph API.
  I want to sort it by comment_count, like_count, time in javascript.</p>
  
  <pre><code>[
    {
     "status_id": "1",
     "message": "message1",
     "comment_info": {
       "comment_count": "1"
      },
      "like_info": {
      "like_count": "0"
     },
    "time": "1380046653"
    },
   {
    "status_id": "2",
    "message": "message2",
    "comment_info": {
     "comment_count": "2"
    },
    "like_info": {
     "like_count": "5"
    },
    "time": "1368109884"
   }
  </code></pre>
  
  <p>]
  I wrote function like below,</p>
  
  <pre><code>function sortResults(prop, asc) {
   statusString = statusString.sort(function(a, b) {
      if (asc) return (a[prop] &gt; b[prop]) ? 1 : ((a[prop] &lt; b[prop]) ? -1 : 0);
      else return (b[prop] &gt; a[prop]) ? 1 : ((b[prop] &lt; a[prop]) ? -1 : 0);
   });
   console.log(statusString);
  }
  </code></pre>
  
  <p>And on button click </p>
  
  <pre><code>sortResults(['comment_info']['comment_count'], true);   
  </code></pre>
  
  <p>But it sorts weiredly.</p>