Math.max Function
Returns the larger of a set of supplied numeric expressions.
语法
Math.max([number1[, number2[... [, numberN]]]])
备注
The optional number1, number2, ..., numberN
arguments are numeric expressions to be evaluated.
If no arguments are provided, the return value is equal to Number.NEGATIVE_INFINITY. If any argument is NaN
, the return value is also NaN
.
示例
The following code shows how to get the larger of two expressions.
var x = Math.max(107 - 3, 48 * 90); document.write(x); // Output: // 4320
必备条件
在以下文档模式中受支持:怪异模式、Internet Explorer 6标准模式、Internet Explorer 7标准模式、Internet Explorer 8标准模式、Internet Explorer 9标准模式、Internet Explorer 10标准模式、Internet Explorer 11标准模式。应用商店应用(Windows 8和Windows Phone 8.1)中也受支持。请参阅版本信息。