Open this example in the interactive library
Source code
const key = (t) => t.toLowerCase().replace(/^(the|a|an)\s+/, "");
console.log(
["The Press", "An Atlas", "Paper"].toSorted((a, b) =>
key(a).localeCompare(key(b)),
),
);
Sample output
[ 'An Atlas', 'Paper', 'The Press' ]
