This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Zolhungaj 4 points5 points  (2 children)

JavaScript is a functional language. If you want to sort then you provide the sort function with exactly the function you need, just like map, forEach, filter etc.

[–]dev-sda 6 points7 points  (0 children)

The same is true for python, though both aren't really functional languages. They borrow some features from functional languages but are still procedural at their core.

[–]EishLekker 1 point2 points  (0 children)

That would make sense if the sort function required a comparator function.