Home >>JavaScript Math Reference >JavaScript min() Method
The math min() Method The result is +Infinity if no arguments are given. The min() function is a static function of the math object and it is always used at math.min(). If any parameter isn’t a number and can’t be converted into one then, Math.min() function returns NaN.
Syntax:Math.min(value1, value2, ...)
Parameter | Description |
---|---|
n1, n2, n3, ..., nX | It is optional. You can compare one or more numbers |
Method | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
min() | Yes | Yes | Yes | Yes | Yes |
<html> <body> <button onclick="myMin()">click me</button> <p id="min"></p> <script> function myMin() { document.getElementById("min").innerHTML = Math.min(15, 25); } </script> </body> </html>
<html> <body> <script> document.write("Output : " + Math.min()); </script> </body> </html>