IntermediateJavaScript
Sort an array of objects by a property
Write a function to sort an array of objects by a specified property.
Examples
Input: [{name: "Alice", age: 25}, {name: "Bob", age: 22}] by age
Output: [{name: "Bob", age: 22}, {name: "Alice", age: 25}]
Your Solution
Output
Click 'Run Code' to see the output