Home >>JavaScript Math Reference >JavaScript min()  Method

JavaScript min()  Method

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 Values

Parameter Description
n1, n2, n3, ..., nX It is optional. You can compare one or more numbers

Browser Support

Method Chrome Edge Firefox Safari Opera
min() Yes Yes Yes Yes Yes
Here is an example of JavaScript min() Method
<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>
Output:

Example 2:
<html>
<body>
<script> 
document.write("Output : " + Math.min()); 
</script> 
</body>
</html>
Output:

No Sidebar ads