showing results for - "sort by timestamp javascript"
Emilie
24 Aug 2019
1array.sort((x, y) => +new Date(x.createdAt) - +new Date(y.createdAt));
Jacob
18 Mar 2020
1const sortedActivities = activities.sort((a, b) => b.date - a.date)
2
Leonie
11 Jan 2019
1// If needed, convert `.timestamp` into a date with `new Date(x.timestamp)`
2myList.sort(function(x, y){
3    return x.timestamp - y.timestamp;
4})
5
Jonah
14 Jan 2020
1const months = ['March', 'Jan', 'Feb', 'Dec'];
2months.sort();
3console.log(months);
4// expected output: Array ["Dec", "Feb", "Jan", "March"]
similar questions
queries leading to this page
sort by timestamp javascript