The key of the object to base the sorting on. The key must have values of either type string or number.
A comparator function to sort objects by the specified key. The comparator can be used in array sort operations. For numbers, it sorts in descending order. For strings, it sorts in ascending lexicographical order.
Creates a sorting function for an array of objects based on a specified key.