The max() method returns the number with the highest value.
The max() method returns the number with the highest value.
Math.min(n1,n2,n3, ..., nX)
Parameter | Require | Description |
---|---|---|
n1, n2, n3, ..., nX | Optional. | One or more numbers to compare |
A Number, representing the lowest number of the arguments
Infinity if no arguments are given
NaN if one or more arguments are not numbers
Return the number with the lowest value:
//return the lowest number of 5 and 10. console.log(Math.min(5, 10));/* w ww.j av a 2 s .c o m*/ //Return the number with the lowest value: //compare numbers and return the lowest. var a = Math.min(5, 10); var b = Math.min(10, 150, 30, 20, 38); var c = Math.min(-15, 10); var d = Math.min(-15, -10); var e = Math.min(1.15, 2.5); var x = a + "\n" + b + "\n" + c + "\n" + d + "\n" + e; console.log(x);