Math.min() method is used to return the smallest number. If we give the two are more number in the argument we want to find the smallest number. We can use this min method. If we don't give the any number it will return the + infinity value.
Syntax:
Math.min(x)
Example:
<script> var one = Math.min(5, -2, 10); document.writeln('Output of 5, -2 , 10 is : ' + one + '</br></br>'); var two = Math.min(100,-80, 70); document.writeln('Output of 100,-80, 70 is : ' + two + '</br></br>'); var three = Math.min(); document.writeln('Output of is : ' + three + '</br></br>'); var four = Math.min(88, 50, 30); document.writeln('Output of 88, 50, 30 is : ' + four + '</br></br>'); </script>
Output:
Output of 5, -2 , 10 is : -2 Output of 100,-80, 70 is : -80 Output of is : Infinity Output of 88, 50, 30 is : 30