Returns the largest element in an iterable. The optional key argument specifies a transform on the elements before comparing them. If the elements in the iterable are objects that implement a custom gt method, this will be called to compare.
Returns
The largest element in the iterable.
Parameters
iterable: number[]
The iterable to inspect.
Returns number
max<T>(iterable: Iterable<T>, key?: Predicate<T, any>): T
Returns the largest element in an iterable. The optional
key
argument specifies a transform on the elements before comparing them. If the elements in the iterable are objects that implement a customgt
method, this will be called to compare.Returns
The largest element in the iterable.