English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JavaScript Math.min() Method

 JavaScript Math Object

Math.min()The method returns the minimum value.

If no arguments are provided, the result is Infinity.

If at least one argument cannot be converted to a number, the result is NaN.

Since min() is a static method of Math, you always use it asMath.min(),instead of using it as a method of the created Math object.

Syntax:

Math.min(n1, n2, n3, ..., nX)
Math.min(10, 20); //  10
Math.min(-10, -20);   // -20
Math.min(1, 3, 2);//  1
Math.min(4, 3, 7, 12);//  3
Math.min(5, 2, 2, 4, 97, 26); //  2
Test and see‹/›

Browser Compatibility

All browsers fully support the Math.min() method:

Method
Math.min()YesYesYesYesYes

Parameter Value

ParameterDescription
n1, n2, n3, ..., nXCompare one or more numbers

Technical Details

Return Value:Returns the smallest number in the given numbers. If at least one argument cannot be converted to a number, it returnsNaN
JavaScript Version:ECMAScript 1

 JavaScript Math Object