I have an array that looks something like this:
var arr = [{user: '3', cash: 2},
{user: 'tim', cash: 3},
{user: '5', cash: 2},
{user: 'noah', cash: 3}]
I sort it by top earners like this:
arr.sort(function (a, b) {
return b.tS - a.tS;
});
It works fine, but after I've sorted the guys with the highest cash I want to also sort everyone alphabetically by the user field. Keep in mind that some of the users may have numbers but of type String (not Number).
I can't use libraries and I'd prefer it to work as fast as possible machine-wise.