I'm having a problem with sorting an object.
Lets say my array looks like this:
[{name:'a', type: 'letter', date:'30897887', active: true},
{name:'b', type: 'letter', date:'30897888', active: true},
{name:'c', type: 'number', date:'30897889', active: true},
{name:'d', type: 'letter', date:'30897890', active: false},
{name:'e', type: 'letter', date:'30897895', active: true},
{name:'f', type: 'number', date:'30897878', active: false},
{name:'g', type: 'letter', date:'30897823', active: true},
{name:'h', type: 'idk', date:'30897885456', active: true}]
I need to show the active and the not active ones by toggling the view, in this I've been successful.
What's driving me insane is: I need to group them by type with a specific order.
I cannot wrap my head around a method.
Let's say the order should be "all the objects with type = number first, then idk, and letter at the end.".
How can i do it?