DEV Community

Discussion on: JS: Sort an Array of Objects on multiple columns/keys

Collapse
 
jsolano profile image
J.P. Solano

Thank you ! great post, I'll add the use case when have two string columns and need to order. My solution was concat first and then a.localeCompare(b)

Collapse
 
markbdsouza profile image
Mark Dsouza

Ohhhh. At the beginning I thought there might be some edge cases your method might not work really well... but, it surely will get the job done. :D
That is a pretty neat work around !!