For string properties, use localeCompare() instead of subtraction. This handles alphabetical order correctly.
const users = [
{ name: "Bob" },
{ name: "Alice" }
];
users.sort((a, b) => a.name.localeCompare(b.name));
// Alice, Bob
localeCompare returns negative, zero, or positive, which sort() needs.