I have a list of users (six to be exact) in a collection with \'firstname\', \'lastname\' properties. Doing a fetch, the comparator below sorts them by \'firstname\', and it wor
Underscore's sortBy
which Backbone uses, returns the sorted collection not sort it in place...
To illustrate:
var flinstones = [{first: 'Baby', last: 'Puss'}, {first: 'Fred', last: 'Flinstone'}];
var sorted = _.sortBy(flinstones, function (character) { return character.last ; });
console.log(sorted);
console.log(flinstones);