My Javascript array has the fields title, modifiedDate and seq
I already have this sort function:
self.tests.sort(function (a, b) {
var diff = a.title.localeCompare(b.title);
var aDate = a.modifiedDate || "";
var bDate = b.modifiedDate || "";
return diff == 0 ? bDate.localeCompare(aDate) : diff;
});
Now I need to extend it to sort by
- title
- modifiedDate
- seq
I've only every seen a two field sort like this. How can I extend it to sort on the seq field also?