JavaScriptSort an array of objects using javascript
function sortByProperty(arr, property) {
return arr.sort((a, b) => (a[property] > b[property] ? 1 : -1));
}
function sortByProperty(arr, property) {
return arr.sort((a, b) => (a[property] > b[property] ? 1 : -1));
}