Math.min Function (JavaScript)

Returns the smaller of a set of numeric expressions.

Math.min([number1[, number2[... [,numberN]]]])

The optional number1, number2, ..., numberN arguments are numeric expressions to be evaluated.

If no arguments are provided, the return value is equal to Number.POSITIVE_INFINITY. If any argument is NaN, the return value is also NaN.

The following code shows how to get the smaller of two expressions.

var x = Math.min(107 - 3, 48 * 90);
document.write(x);

// Output:
// 104

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported in Store apps (Windows 8 and Windows Phone 8.1). See Version Information.

Show:
© 2014 Microsoft