title: Sort JSON Object by date value
body: <p>I have an object in javascript</p>
  
  <pre><code>Object {HIDDEN ID: "06/03/2014", HIDDEN ID: "21/01/2014"}
  </code></pre>
  
  <p>I want to be able to create a new object that will have it sorted by recent date.</p>
  
  <p>Like so:</p>
  
  <pre><code>SortedObject {"HIDDEN ID" : "21/01/2014", "HIDDEN ID" : "06/03/2014"}
  </code></pre>
  
  <p>I know how I could achieve this with an array but I dont know how to iterate through objects to sort by date.</p>
  
  <p>Any help is much appreciated</p>
  
  <p>EDIT:</p>
  
  <p>Now I Have this code.</p>
  
  <pre><code>for(var x=0; x&lt;folderList.length; x++){
                      retrieveAllFilesInFolder(folderList[x], function(){
                          var arr = []; 
                          for(var i in fileListObj) { 
                             var d = fileListObj[i].split("/");
                             arr.push({"id": i, "date":(new Date(d[2],d[1]-1,d[0]))}); 
                          }
                          arr.sort(function(a,b) { return a.date &lt; b.date;});
                          console.log(arr); 
                      });
                  }
  </code></pre>
  
  <p>However my output is not sorted bydate.</p>
  
  <pre><code>Object 1 id: "hiddenID1", date: Mon Nov 18 2013 00:00:00 GMT+0000 (GMT Standard Time)
  Object 2 id: "hiddenId2", date: Thu Mar 06 2014 00:00:00 GMT+0000 (GMT Standard Time)
  Object 3 id: "hiddenId3", date: Thu Sep 05 2013 00:00:00 GMT+0100 (GMT Daylight Time)
  </code></pre>