JavaScript Math.max()
例
let x = Math.max(5, 10);
その他の例
let a = Math.max(5, 10);
let b = Math.max(0, 150, 30, 20, 38);
let c = Math.max(-5, 10);
let d = Math.max(-5, -10);
let e = Math.max(1.5, 2.5);
ブラウザのサポート
Math.max()
ECMAScript1(ES1)機能です。
ES1(JavaScript 1997)は、すべてのブラウザーで完全にサポートされています。
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |
構文
Math.max(n1, n2, n3, ..., nX)
パラメーター
Parameter | Description |
---|---|
n1, n2, n3, ..., nX | Optional. One or more numbers to compare |
戻り値
: | 引数の最大数を表す数値。-引数が指定されていない場合は 無限大。1つ以上の引数が数値でない場合は NaN 。 |
---|