Javascript Math.min()方法
作者:--
发布时间:2019-11-20
评论:0
阅读:9
此方法返回零个或多个最小的数字。如果没有给出参数,结果是正无穷
语法
math.min(value1, value2, ... valuen ) ;
下面是参数的详细信息:
返回值:
返回零个或多个最大的数字。
例子:
<html>
<head>
<title>javascript math min() method</title>
</head>
<body>
<script type="text/javascript">
var value = math.min(10, 20, -1, 100);
document.write("first test value : " + value );
var value = math.min(-1, -3, -40);
document.write("<br />second test value : " + value );
var value = math.min(0, -1);
document.write("<br />third test value : " + value );
var value = math.min(100);
document.write("<br />fourth test value : " + value );
</script>
</body>
</html>
这将产生以下结果:
first test value : -1
second test value : -40
third test value : -1
fourth test value : 100