I'm having a function sort some json based on the object property. It works when I hard code the property into the sort function, but when it tries to pull it dynamically from the display_list function (sortCat), it doesn't work. resultDeals is the json
function display_list(sortCat) {
if (resultDeals !== undefined) {
resultDeals.sort(function(a, b) {
return a.sortCat - b.sortCat;
});
for(i = 0; i < resultDeals.length; i++) {
where sorted data is printed
}
}
}