Function max

  • Find the maximum in an array.

    Type Parameters

    • T

    Parameters

    • array: T[]

      An array.

    • Optional iteratee: ((obj) => number)

      The iteratee invoked on each element.

        • (obj): number
        • Parameters

          • obj: T

          Returns number

    Returns number

    Returns the maximum.

    Since

    0.5.1

    Example

    max([1, 2, 3])
    // => 3

    const objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]
    max(objects, ({ n }) => n)
    // => 8