Skip to content

max

max(x): number

Defined in: src/max.js:15

This computes the maximum number in an array.

This runs in O(n), linear time, with respect to the length of the array.

If any value is NaN, the result is NaN, wherever that value appears.

number[]

sample of one or more data points

number

maximum value

if the length of x is less than one

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