max

The maximum of two values.

Math.max(8, 2);

You find the larger of two numbers with the max function.

Parameters

a: The first number to check to see if it is more than the second number. b: The second number to check to see if it is more than a first number.

Returns

  • the larger of the two numbers in a or b.

Example

Find out which value is more: 7 or 16.

let minival = Math.max(7, 16);

See also

min