I need to sort an object array by date values:
array.sort(function(a,b){
return new Date(b.date) - new Date(a.date);
})
But if date is undefined, it should be placed at the beginning. With my code shown above, the empty datasets will be placed at the end.
array.sort(/* ...other code here... */).reverse()