binding function for Array.prototype.toSorted.