JavaScript中的Math.max()函数
max()Math对象的函数接受多个数字,并返回其中最大的数字。
如果将单个数字传递给此函数,它将返回相同的
而且,如果不传递任何参数,它将返回无穷大。
语法
其语法如下
Math.max(48, 148, 3654);
示例
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<script type="text/javascript">
var result = Math.max(48, 148, 3654);
document.write("Maximum of the given numbers: "+result);
</script>
</body>
</html>输出结果
Maximum of the given numbers: 3654