I'm trying to get a multi-array / nested map sorted by value via JavaScript / TypeScript.
My array currently looks like this:
let array =
[
{
classification: {
company_id: 1
},
information: {
name: 'C'
}
},
{
classification: {
company_id: 1
},
information: {
name: 'B'
}
},
{
classification: {
company_id: 1
},
information: {
name: 'A'
}
}
];
Now I'd like to sort by the ['information']['name'] values like this:
let array_sorted =
[
{
classification: {
company_id: 1
},
information: {
name: 'A'
}
},
{
classification: {
company_id: 1
},
information: {
name: 'B'
}
},
{
classification: {
company_id: 1
},
information: {
name: 'C'
}
}
];
Does anybody know how to do that? I'm especially struggling with the nested stuff...
Thank you in advance!