javascript sort array of objectsby key string code example
Example 1: array sort by alphabetical javascript
users.sort((a, b) => a.firstname.localeCompare(b.firstname))
Example 2: javascript sort array of objects by key value
arr.sort((x, y) => x.distance - y.distance);