DEV Community

Discussion on: Sorting Arrays of Strings in JavaScript

Collapse
 
charlesmwray profile image
Charles Wray

Love this reply. It's exactly what I was looking for. I do want to comment that there is a typo in case someone else tries to use this like I did and it didnt work. In the localeSort variable assignment it should be

return a.localeCompare(b, 'en', { sensitivity: 'base' });

Collapse
 
ricardorien profile image
Ricardo Aguilar

Thanks! both anwser are awesome!