From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../reference/global_objects/infinity/index.html | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 files/zh-cn/web/javascript/reference/global_objects/infinity/index.html (limited to 'files/zh-cn/web/javascript/reference/global_objects/infinity') diff --git a/files/zh-cn/web/javascript/reference/global_objects/infinity/index.html b/files/zh-cn/web/javascript/reference/global_objects/infinity/index.html new file mode 100644 index 0000000000..7d8e6cb3c4 --- /dev/null +++ b/files/zh-cn/web/javascript/reference/global_objects/infinity/index.html @@ -0,0 +1,57 @@ +--- +title: Infinity +slug: Web/JavaScript/Reference/Global_Objects/Infinity +tags: + - JavaScript +translation_of: Web/JavaScript/Reference/Global_Objects/Infinity +--- +
{{jsSidebar("Objects")}}
+ +

全局属性 Infinity 是一个数值,表示无穷大。

+ +

{{js_property_attributes(0,0,0)}}

+ +

{{EmbedInteractiveExample("pages/js/globalprops-infinity.html")}}

+ +

描述

+ +

Infinity全局对象global object)的一个属性,即它是一个全局变量。

+ +

Infinity 的初始值是 {{jsxref("Number.POSITIVE_INFINITY")}}。Infinity(正无穷大)大于任何值。

+ +

该值的意义与数学无穷大略有不同。 有关详细信息,请参见{{jsxref("Number.POSITIVE_INFINITY")}}。

+ +

在 ECMAScript 5 的规范中, Infinity 是只读的(实现于 JavaScript 1.8.5 / Firefox 4)。

+ +

示例

+ +
console.log(Infinity          ); /* Infinity */
+console.log(Infinity + 1      ); /* Infinity */
+console.log(Math.pow(10, 1000)); /* Infinity */
+console.log(Math.log(0)       ); /* -Infinity */
+console.log(1 / Infinity      ); /* 0 */
+ +

规范

+ + + + + + + + + + +
规范
{{SpecName('ESDraft', '#sec-value-properties-of-the-global-object-infinity', 'Infinity')}}
+ +

浏览器兼容性

+ +

{{Compat("javascript.builtins.Infinity")}}

+ +

相关链接

+ + -- cgit v1.2.3-54-g00ecf