Generation

generate functionSat, 12 Nov 2022

Sort an array of dates

Script function sortDates(dateArray){ return dateArray.sort(function(a,b){ return new Date(a) - new Date(b); }); } sortDates(["2014-01-01", "2016-01-01", "2010-01-01"]);

Questions about programming?Chat with your personal AI assistant