max Function

Top  Previous  Next

Returns the number with the highest value.

Syntax

Math.max(number1, number2, ...)

Arguments

number1A number.
number2A number.

Return Value

Returns the highest number of the arguments, or NaN if one or more arguments are not numbers.

Example

Math.max(2,10);       // Returns 10

Math.max(-2,10);      // Returns 10

See also

Math.min