I am looking for a function (preferably using lodash, etc.) that will take the array and yield the expected output as follows:
const arr = [{name: 'Anna', score:4}, {name: 'Bob', score:5}, {name: 'Chris', score:4}]
// expected output
// [{name: 'Anna', score:4}, {name: 'Chris', score:4}, {name: 'Bob', score:5}]
i.e. the function should sort by:
1) the frequency of the 'score' property
2) the 'name' property (where scores are equal)
Note that because of (1), this question is not the same as those marked as duplicates.