I have to sort my array of objects based on their status property
for example, I have the following array
[
{userName:"One", status:"Live"},
{userName:"Two", status:"Rejected"},
{userName:"Three", status:"To Do"},
{userName:"Four", status:"Verify"},
{userName:"Five", status:"Received"},
{userName:"Six", status:"In Progress"}
]
after sorting, I need an array that looks like
[
{userName:"Three", status:"To Do"},
{userName:"Five", status:"Received"},
{userName:"Six", status:"In Progress"},
{userName:"Two", status:"Rejected"},
{userName:"Four", status:"Verify"},
{userName:"One", status:"Live"}
]
Need to sort the items based on its status property in following order
- To Do
- Received
- In Progress
- Rejected
- Verify
- Live
There can be more than one item with same status.