DEV Community

Discussion on: Javascript array sort with Reducer

Collapse
 
tiagojpdias profile image
Tiago Dias

What??

[6,3,-1,2].sort() // [ -1, 2, 3, 6 ]
Enter fullscreen mode Exit fullscreen mode

Which is completely fine. I think you missed the point here...

Array.prototype.sort accepts a callback as a custom sorter.

What a convoluted piece of "code". Awful use case to make your point across.