javascript min() method


  Translation results:

abbr.minute minute;minuto (Portuguese or Spanish=minute) (Portuguese or Spanish) minute;minority minority;miniature small

javascript min() methodsyntax

Function: Returns the number with the lowest value among the specified numbers.

Syntax: Math.min(x,y)

Parameters: x 0 or more values. Prior to ECMASCript v3, this method had only two parameters.

Return: Return the smallest value among the parameters. If there are no parameters, Infinity is returned. If an argument is NaN, or a non-numeric value that cannot be converted to a number, NaN is returned.

javascript min() methodexample

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script type="text/javascript">
//使用 min() 来返回指定数字中带有最小值的数字
    document.write(Math.min(5,7) + "<br />")
    document.write(Math.min(-3,5) + "<br />")
    document.write(Math.min(-3,-5) + "<br />")
    document.write(Math.min(7.25,7.30))

</script>

</body>
</html>

Run instance »

Click the "Run instance" button to view the online instance

Home

Videos

Q&A