I am passing my string to the below function.
$scope.sort= function(query){
console.log(query); // results "name";
$scope.resultset.sort(function(a, b) {
return parseFloat(b.query) - parseFloat(a.query); //results undefined;
});
};
where b
and a
are my objects in resultset Array.
How to find the props in obj with variable name?