I would like to have a function to sort an array of objects by getting a string as input that include the name of the property and sort direction. I need something like this :
var myArray = [{name:"A", age: 30}, {name:"B", age:20}, {name:"C", age:20}];
var strSort = "age asc, name desc";
var sortedArray = customSortFuntion(myArray,strSort);
//sortedArray == [{name:"C", age:20}, {name:"B", age:20},{name:"A", age: 30}]
function customSortFuntion(myArray,strSort)
{
//return sorted by age asc and sorted by name desc etc..??
}