Home>Article>Web Front-end> How to use min function

How to use min function

Jennifer Aniston
Jennifer Aniston Original
2019-02-16 17:44:58 6934browse

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.

How to use 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to use max function Next article:How to use max function