English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
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.
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); // 2Test and see‹/›
All browsers fully support the Math.min() method:
Method | |||||
Math.min() | Yes | Yes | Yes | Yes | Yes |
Parameter | Description |
---|---|
n1, n2, n3, ..., nX | Compare one or more numbers |
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 |