Skip to content
Advertisement

Sort a 2d array by its name column but ignoring the names’ prefixes

I want to sort an array of rows by the name column value, but critically I want to sort while ignoring the users’ prefixes.

Sample array:

JavaScript

Desired result:

JavaScript

My current code:

JavaScript

Advertisement

Answer

You make it clear in your comment that you originally have the name as firstname lastname, title, so you just need to sort first, then move the title to the front:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement