Urutkan array berdasarkan naskah tanggal
array.sort((x, y) => +new Date(x.createdAt) - +new Date(y.createdAt));
Crowded Caracal
array.sort((x, y) => +new Date(x.createdAt) - +new Date(y.createdAt));
// If needed, convert `.timestamp` into a date with `new Date(x.timestamp)`
myList.sort(function(x, y){
return x.timestamp - y.timestamp;
})
const sortedActivities = activities.sort((a, b) => b.date - a.date)
const months = ['March', 'Jan', 'Feb', 'Dec'];
months.sort();
console.log(months);
// expected output: Array ["Dec", "Feb", "Jan", "March"]