How to sort an array of objects by date?
recent.sort(function(a,b) { return new Date(a.start).getTime() - new Date(b.start).getTime() } );
ES6:
recent.sort((a,b)=> new Date(b.start).getTime()-new Date(a.start).getTime());
As has been pointed out in the comments, the definition of recent isn't correct javascript.
But assuming the dates are strings:
var recent = [
{id: 123,age :12,start: "10/17/13 13:07"},
{id: 13,age :62,start: "07/30/13 16:30"}
];
then sort like this:
recent.sort(function(a,b) {
return new Date(a.start).getTime() - new Date(b.start).getTime()
});
More details on sort function from W3Schools