I have an array of objects like below.
var array = [{id: 1, date:'Mar 12 2012 10:00:00 AM', status:'done'},
{id: 2, date:'Mar 8 2012 08:00:00 AM', status:'done'},
{id: 3, date:'Mar 15 2012 10:00:00 AM', status:'done'},
{id: 4, date:'Mar 5 2012 08:00:00 AM', status:'done'},
{id: 5, date:'Mar 30 2012 10:00:00 AM', status:'done'},
{id: 6, date:'Mar 5 2012 08:00:00 AM', status:'done'},
{id: 7, date:'Mar 1 2012 10:00:00 AM', status:'done'},
{id: 8, date:'Mar 7 2012 08:00:00 AM', status:'notdone'},
{id: 9, date:'Mar 12 2012 10:00:00 AM', status:'notdone'},
{id: 10, date:'Mar 2 2012 10:00:00 AM', status:'notdone'},
{id: 11, date:'Mar 6 2012 10:00:00 AM', status:'notexist'},
{id: 12, date:'Mar 8 2012 08:00:00 AM', status:'notexist'}];
I am trying to sort first few elements in my array which has status:'done'
and leave remaining records as it is.
Can someone help me with how I can put this condition and sort
the elements.
Thanks.
question from:
https://stackoverflow.com/questions/65948517/how-to-sort-only-few-elements-in-an-array-of-object-by-date-property 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…