Let's say I have an array like this:
var objects = [
{ name: "steve", status: added },
{ name: "john", status: added },
{ name: "drew", status: none },
{ name: "aaron", status: none },
{ name: "jeff", status: hidden },
{ name: "gil", status: hidden },
{ name: "marc", status: removed },
{ name: "bill", status: removed }
];
...and I would like to sort it by status but have:
- the "removed" ones first,
- the "added" ones second,
- the "none" ones third, and
- the "hidden" ones last.
Seeing as how that is not alphabetical how would I go about doing this using the sort method?
The only idea I could think of is to make each object with their respective statuses an array then concat them back together. Thank you.