min

The minimum of two values.

Math.min(8, 2);

You find the smaller of two numbers with the min function.

Parameters

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

Returns

  • the smaller of the two numbers a or b.

Example

Find out which value is less: 2 or 9.

let minival = Math.min(2, 9);

See also

max