I used following function for sorting array.
var trArr = [{'Abc', 1}, {'ACd', 3}, {'Aab', 4}];
function compare(a,b) {
if (a.name > b.name)
{
return -1;
}
if (a.name < b.name)
{
return 1;
}
return 0;
}
trArr.sort(compare);
result:
[{'ACd', 3}, {'Aab', 4}, {'Abc', 1}];
above result is due to capital 'C'
I need the following result:
[{'Aab', 4}, {'Abc', 1}, {'ACd', 3}];