How can I JavaScript sort alphabetically by first name in an array of objects? I have an array that includes objects like this:
var user = {
bio: null,
email: "user@domain.example",
firstname: "Anna",
id: 318,
lastAvatar: null,
lastMessage: null,
lastname: "Nickson",
nickname: "anny"
};
What’s the best way to sort this array by the firstname property?