Proposal idea: descending sort

Yeah, a function to reverse a comparison function is much more natural.

That's what Java and Rust do, for example.

Only problem is where to put it. Function.prototype is kind of a weird place though I guess it would work. But I also think we should have some more built-in comparison functions, like the standard numeric one, so maybe a new namespace like Compare? As in, array.sort(Compare.numeric) for ascend sorting by numeric order, array.sort(Compare.reverse(Compare.numeric)) for descending sort.

3 Likes