DEV Community

loading...

Discussion on: Proper sorting with JavaScript

Collapse
alexparra profile image
Alex Parra

Hi Adam!
For strings, the String method localeCompare seems the right way to do it.
What downsides do you see with it? Might have a performance penalty but shouldn’t be relevant unless sorting a massive array?
Best.

Collapse
adamkdean profile image
Adam K Dean Author

Good question Alex! I'm not entirely sure. This was written a number of years ago while I worked for bravissimo.com (hence the example above being bra sizes!)