Skip to content

Math.min

Arsen Melikyan edited this page · 1 revision
Clone this wiki locally

Math.min()

The Math.min() function returns the smallest of zero or more numbers.

Syntax

Math.min(value1, value2, ...)

Parameters

value1, value2 and other arguments should be numbers. All arguments are optional.

If no arguments are given, the result is Infinity. If at least one of arguments cannot be converted to a number, the result is NaN.

MDN link | MSDN link

Examples

Math.min();         // Infinity
Math.min('a');      // NaN
Math.min(NaN);      // NaN
Math.min(5);        // 5
Math.min(-1, 10);   // -1
var x = Math.min(107 - 3,  48 * 90);
document.write(x);

// Output:
// 104
Something went wrong with that request. Please try again.