I have an Array like this
let arr = [
{label: "Bob Bobson", value: 17345, group: "Applicants"}
{label: "Frank Frankson", value: 17347, group: "Applicants"}
{label: "Bill Billson", value: 17348, group: "Applicants"}
{label: "John Johnson", value: 1, group: "Caregivers"}
{label: "Aaron Aaronson", value: 15, group: "Caregivers"}
{label: "Jacob Jacobson", value: 172, group: "Clients"}
{label: "Eric Ericsson", value: 1441, group: "Clients"}
{label: "Doc Docson", value: 1147, group: "Doctors"}
]
I want to sort it using two of the property values in the object, the label property and the group property. I'm currently not getting any results however. I want to sort by group first and then label.
Here is what I am trying below.
arr.sort((a, b) => { a.label.toUpperCase() > b.label.toUpperCase()) ? 1 : -1 });
Using this I get the same results back, the label property doesn't get sorted.