name of an element property
Optional
order: numberany positive number for ascending (default); negative for descending (0 retains original order, i.e. the sort has no effect)
the given array
Like sortArrayBy:STRING_KEYS_SAME_ORDER, but allows passing a specific order for each key. Ascending order is assumed for any key without corresponding order.
Like sortArrayBy:STRING_KEYS_SAME_ORDER, but allows passing one or more functions that return the sort values of a given element.
Optional
order: numberLike sortArrayBy:FUNCTION_KEYS_SAME_ORDER, but allows passing a specific order for each key. Ascending order is assumed for any key without corresponding order.
Sorts an array in place by one or more specific keys. If two elements compare equally with a given key, the next one is tried, and so on. The same order is applied for all keys.
If you need to preserve the original array, make a copy first with e.g. Array.slice.
Values of differing types are sorted in groups in this order: nullish, booleans, numbers (including numeric strings), strings, symbols, objects, functions. Objects are sorted by Object.valueOf if that returns a primitive, their JSON representation otherwise (note arrays fall into this category as well). Functions are sorted by Function.toString. All strings are sorted case-insensitive (including string obtained from objects or functions)
NOTE this is unlike Array.sort, which sorts by string representation and moves all undefined elements to the end.