サイト内検索

Math メソッド一覧

スポンサー

ホーム > Math > min

min

最小値を返します.

シンタックス

Math.min(x1, x2, ..., xn)
  • xn - 数値

解説

minメソッドは引数で指定された数値の最小値を返します.

サンプルコード

以下にminメソッドを使用したサンプルコードを示します.

<html>
  <head>
    <title>minメソッドのサンプルコード</title>
  </head>
  <body>
    <script type="text/javascript" language="javascript">
      document.write(Math.min(1, 2, 3, 4, 5) + "<br />");
      document.write(Math.min(-1, -2, -3, -4, -5) + "<br />");
      document.write(Math.min("1", "2", "3", "4") + "<br />");
      document.write(Math.min("N") + "<br />");
      document.write(Math.min() + "<br />");
    </script>
  </body>
</html>

実行例

サンプルコードの実行結果は以下のようになります.

1
-5
1
NaN
Infinity

関連項目

スポンサード リンク

inserted by FC2 system