• Returns the largest value in an array of numbers

    Parameters

    • data: number[]

      Array of numbers to find maximum from

    Returns number

    The maximum value in the array

    If array is empty

    const numbers = [10.5, 2.3, 15.7];
    const maximum = max(numbers); // Returns 15.7
    • Uses Math.max() with spread operator for efficient calculation
    • Validates array is non-empty before processing