DEV Community


Discussion on: Proper sorting with JavaScript

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?

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 (hence the example above being bra sizes!)