Sort date in Javascript
问题 I have retrieve from ajax query a news feed. In this object, there is a date in this format : Wed, 22 May 2013 08:00:00 GMT I would like to sort all objects by date. Is it possible to do this using Javascript ? UPDATE Using this piece of code it works fine ! array.sort(function(a,b){ var c = new Date(a.date); var d = new Date(b.date); return c-d; }); 回答1: 1) You can't sort objects. The order of the object's keys is arbitrary. 2) If you want to sort an array by date (and they are already date