Рет қаралды 18,209
This video discusses how you can run sorts on Arrays of Numbers or Arrays of Objects to get the proper results.
The problem with the default Array.sort method is that it converts everything to Strings before doing its comparison.
We can create our own custom sort function to handle non-string sorts.
Code GIST: gist.github.com/prof3ssorSt3v...
See Also: This tutorial on the JavaScript International Object's string compare method for dealing with multilingual sorts.