目录

POSITIVE_INFINITY

描述 (Description)

这是一个特殊的数值,表示任何大于Number.MAX_VALUE的值。 该值表示为“无穷大”。 它的数学行为类似无穷大。 例如,任何乘以POSITIVE_INFINITY的东西都是POSITIVE_INFINITY,任何除以POSITIVE_INFINITY的东西都是零。

由于POSITIVE_INFINITY是常量,因此它是Number的只读属性。

语法 (Syntax)

使用以下语法来使用POSITIVE_INFINITY。

var val = Number.POSITIVE_INFINITY;

例子 (Example)

请尝试以下示例以了解如何使用POSITIVE_INFINITY。

<html>
   <head>
      <script type="text/javascript">
         <!--
            function showValue()
            {
               var bigNumber = Number.MAX_VALUE * 2
               if (bigNumber == Number.POSITIVE_INFINITY) {
                  alert("Value of bigNumber : " + bigNumber );
               }
            }
         //-->
      </script>
   </head>
   <body>
      <p>Click the following to see the result:</p>
      <form>
         <input type="button" value="Click Me" onclick="showValue();" />
      </form>
   </body>
</html>

输出 (Output)

新页面打开
↑回到顶部↑
WIKI教程 @2018