Q:

Sort an array of objects based on values in the objects

I have an array of objects
var winners_tie = [
    {name: 'A', value: 111},
    {name: 'B', value: 333},
    {name: 'C', value: 222},
]

I wanna sort it in ascending order of value

A:

Since your values are just numbers, you can return their differences from the comparator function
winners_tie.sort(function(first, second) {
    return first.value - second.value;
});

console.log(winners_tie);

Output
[ { name: 'A', value: 111 },
  { name: 'C', value: 222 },
  { name: 'B', value: 333 } ]

Note: JavaScript's sort is not guaranteed to be stable.

