I want to sort an array based on a inner array value sorted alphabetically. example.
i want this array to be sorted by the prefix “old” so old A, old B etc
const array = [
{ personName: "Vans", personTags: ["young", "old A"] },
{ personName: "Lia", personTags: ["young", "ok"] },
{ personName: "Rein", personTags: ["old B", "hairless", "ok"] },
{ personName: "Cris", personTags: ["old A", "old B", "acrounimouslyness"] },
{ personName: "Mercy", personTags: ["young", "hairless", "ok"] },
{ personName: "Cbum", personTags: ["old C", "hairless", "young"] },
];
becomes
const array = [
{ personName: "Vans", personTags: ["young", "old A"] },
{ personName: "Cris", personTags: ["old A", "old B", "acrounimouslyness"] },
{ personName: "Rein", personTags: ["old B", "hairless", "ok"] },
{ personName: "Cbum", personTags: ["old C", "hairless", "young"] },
];
//would be removed
{ personName: “Lia”, personTags: [“young”, “ok”] },
{ personName: “Mercy”, personTags: [“young”, “hairless”, “ok”] },