Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

sort array of objects javascript by date

array.sort(function(a,b){
  // Turn your strings into dates, and then subtract them
  // to get a value that is either negative, positive, or zero.
  return new Date(b.date) - new Date(a.date);
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sort #array #objects #javascript #date
ADD COMMENT
Topic
Name
1+1 =