SyntaxFix
Write A Post
Hire A Developer
Questions
A more compact notation:
user.sort(function(a, b){ return a.firstname === b.firstname ? 0 : a.firstname < b.firstname ? -1 : 1; })