aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/global_objects/number/positive_infinity
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/javascript/reference/global_objects/number/positive_infinity
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/number/positive_infinity')
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/number/positive_infinity/index.html130
1 files changed, 130 insertions, 0 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/number/positive_infinity/index.html b/files/zh-cn/web/javascript/reference/global_objects/number/positive_infinity/index.html
new file mode 100644
index 0000000000..4207e72e5a
--- /dev/null
+++ b/files/zh-cn/web/javascript/reference/global_objects/number/positive_infinity/index.html
@@ -0,0 +1,130 @@
+---
+title: Number.POSITIVE_INFINITY
+slug: Web/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY
+translation_of: Web/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY
+---
+<div>{{JSRef("Global_Objects", "Number")}}</div>
+
+<h2 id="概述">概述</h2>
+
+<p><code><strong>Number.POSITIVE_INFINITY</strong></code> 属性表示正无穷大。</p>
+
+<p>不必创建一个 {{jsxref("Global_Objects/Number", "Number")}} 实例,可使用 <code>Number.POSITIVE_INFINITY</code> 来访问该静态属性。</p>
+
+<p>{{js_property_attributes(0,0,0)}}</p>
+
+<h2 id="描述">描述</h2>
+
+<p><code>Number.POSITIVE_INFINITY</code> 的值同全局对象 {{jsxref("Global_Objects/Infinity", "Infinity")}} 属性的值相同。</p>
+
+<p>该值的表现同数学上的无穷大有点儿不同:</p>
+
+<ul>
+ <li>任何正值,包括 <code>POSITIVE_INFINITY</code>,乘以 <code>POSITIVE_INFINITY</code> 为 <code>POSITIVE_INFINITY</code>。</li>
+ <li>任何负值,包括 <code>NEGATIVE_INFINITY</code>,乘以 <code>POSITIVE_INFINITY</code> 为 <code>NEGATIVE_INFINITY</code>。</li>
+ <li>0 乘以 <code>POSITIVE_INFINITY</code> 为 NaN。</li>
+ <li>NaN 乘以 <code>POSITIVE_INFINITY</code> 为 NaN。</li>
+ <li><code>POSITIVE_INFINITY</code> 除以 <code>NEGATIVE_INFINITY</code> 以外的任何负值为 <code>NEGATIVE_INFINITY</code>。</li>
+ <li><code>POSITIVE_INFINITY</code> 除以 <code>POSITIVE_INFINITY</code> 以外的任何正值为 <code>POSITIVE_INFINITY</code>。</li>
+ <li><code>POSITIVE_INFINITY</code> 除以 <code>NEGATIVE_INFINITY</code> 或 <code>POSITIVE_INFINITY</code> 为 NaN。</li>
+ <li>任何数除以 <code>POSITIVE_INFINITY</code> 为 0。</li>
+</ul>
+
+<p>You might use the <code>Number.POSITIVE_INFINITY</code> property to indicate an error condition that returns a finite number in case of success. Note, however, that {{jsxref("Global_Objects/isFinite", "isFinite")}} would be more appropriate in such a case.</p>
+
+<h2 id="示例">示例</h2>
+
+<p>下例中,赋值给变量 <code>bigNumber</code> 一个大于 JavaScript 中最大值的值。当 <code>if</code> 语句执行时,变量 <code>bigNumber</code> 值为 "<code>Infinity</code>", 因此在继续执行代码前,为变量 <code>bigNumber</code> 设置一个容易管理的值。</p>
+
+<pre class="brush: js">var bigNumber = Number.MAX_VALUE * 2
+if (bigNumber == Number.POSITIVE_INFINITY) {
+ bigNumber = returnFinite();
+}
+</pre>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>ECMAScript 1st Edition. Implemented in JavaScript 1.1</td>
+ <td>Standard</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.7.3.6', 'Number.POSITIVE_INFINITY')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-number.positive_infinity', 'Number.POSITIVE_INFINITY')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<p>{{ CompatibilityTable() }}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="See_also" name="See_also">相关链接</h2>
+
+<ul>
+ <li>{{jsxref("Number.NEGATIVE_INFINITY")}}</li>
+ <li>{{jsxref("Global_Objects/Infinity", "Infinity")}}</li>
+ <li>{{jsxref("Global_Objects/isFinite", "isFinite")}}</li>
+</ul>