The collection.max( ) method returns the element with the highest value in the collection (the last element of the collection as it would be sorted in ascending order using the collection.sort( ) method).
Note: This method does not modify the original collection.
If the collection contains different types of values, the max( ) function will return the maximum value within the last element type in the type list order (see collection.sort( ) description).
If the collection contains objects, pass the propertyPath parameter to indicate the object property whose maximum value you want to get.
If the collection is empty, collection.max( ) returns Undefined.