I am sending my string to the function below.
$scope.sort= function(query){
console.log(query); // returns "name";
$scope.resultset.sort(function(a, b) {
return parseFloat(b.query) - parseFloat(a.query); //returns undefined;
});
};
where b
and a
represent objects in the resultset Array.
Is there a way to locate the properties in an object using variable name?