how to sort an array into array of objects based on object keys javascript code example
Example 1: sort array of objects javascript
list.sort((a, b) => (a.color > b.color) ? 1 : -1)
Example 2: javascript sort array of objects by key value
arr.sort((x, y) => x.distance - y.distance);