The Array prototype's reverse method modifies the array and returns a reference to it, which means you can do this:
var sortedAsc = _.sortBy(collection, 'propertyName');
var sortedDesc = _.sortBy(collection, 'propertyName').reverse();
Also, the underscore documentation reads:
In addition, the Array prototype's methods are proxied through the chained Underscore object, so you can slip a
reverse
or apush
into your chain, and continue to modify the array.
which means you can also use .reverse()
while chaining:
var sortedDescAndFiltered = _.chain(collection)
.sortBy('propertyName')
.reverse()
.filter(_.property('isGood'))
.value();