• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 334
  • Last Modified:

JavaScript: Order Array by Last Word

Using JavaScript, how can I sort an array by the last word instead of the first?

 var str = 'Joe Doe,Sally Azzu,Amy Zillick,Fred Xand,Rex Bop';
 var people = str.split(',');
 people = people.sort();
 alert(people.join('\n'))

Open in new window

0
hankknight
Asked:
hankknight
1 Solution

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now