Returns a new sorted array, providing the sortFn as the first argument.
const source = [3, 2, 1];sortWith((a, b) => b - a)(source) // [3, 2, 1]sortWith()(source) // [1, 2, 3] Copy
const source = [3, 2, 1];sortWith((a, b) => b - a)(source) // [3, 2, 1]sortWith()(source) // [1, 2, 3]
Optional
Returns a new sorted array, providing the sortFn as the first argument.
Example