Home>Article>Web Front-end> How to use min function
The min() function is used to return the number with the lowest value among the specified numbers. If any parameter is not a number and cannot be converted to a number, the Math.min() function will return NaN. Let's take a look at the specific usage of the min() function.
Let’s first take a look at the basic syntax of themin function
Math.min(value1,value2,...)
Value1, Value2,...: passed to The value of the math.min() function, used to find the minimum value.
Let’s look atspecific examples
The code is as follows
When the parameters are positive and negative numbers:
The code is as follows
The execution result is as follows:
Output : 1 Output : -32
When no parameters are passed
The code is as follows:
The execution result is as follows
Output : -Infinity
When there are parameters in the parameters that cannot be converted to numbers:
The code is as follows
The execution result is as follows
Output : NaN
This This article has ended here. For more exciting content, you can pay attention to other related column tutorials on the PHP Chinese website! ! !
The above is the detailed content of How to use min function. For more information, please follow other related articles on the PHP Chinese website!