mozilla

Revision 451045 of isFinite()

  • Revision slug: JavaScript/Reference/Global_Objects/isFinite
  • Revision title: isFinite
  • Revision id: 451045
  • Created:
  • Creator: zhangyaochun1987
  • Is current revision? No
  • Comment 分享中文版
Tags: 

Revision Content

 

概述

判定一个参数是否是有限数字。

 

Core Global Method
Implemented in JavaScript 1.3
ECMAScript Edition ECMAScript 2

语法

isFinite(number)

参数

number
指定的参数。

描述

isFinite 是全局的方法,不与任何对象有关系。

你可以用这个方法来判定一个数字是否是有限数字。

isFinite 方法以它的参数的方式检查。如果参数是 NaN, 正无穷大或者负无穷大,会返回false,其他返回 true

示例

Example: Using isFinite

你可以检查客户端的输入域是否是有限数字

if (isFinite(ClientInput)) {
   /* take specific steps */
}

查看更多阅读

Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY

 

 

{{ languages( { "es": "es/Referencia_de_JavaScript_1.5/Funciones_globales/isFinite", "fr": "fr/R\u00e9f\u00e9rence_de_JavaScript_1.5_Core/Fonctions_globales/isFinite", "ja": "ja/Core_JavaScript_1.5_Reference/Global_Functions/isFinite", "pl": "pl/Dokumentacja_j\u0119zyka_JavaScript_1.5/Funkcje/isFinite" } ) }}

Revision Source

<p>&nbsp;</p>
<h3 id="Summary" name="Summary">概述</h3>
<p><span style="line-height: inherit;">判定一个参数是否是有限数字。</span></p>
<p>&nbsp;</p>
<table class="standard-table">
  <thead>
    <tr>
      <th class="header" colspan="2">Core Global Method</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Implemented in</td>
      <td>JavaScript 1.3</td>
    </tr>
    <tr>
      <td>ECMAScript Edition</td>
      <td>ECMAScript 2</td>
    </tr>
  </tbody>
</table>
<h3 id="Syntax" name="Syntax">语法</h3>
<p><code>isFinite(<em>number</em>) </code></p>
<h3 id="Parameters" name="Parameters">参数</h3>
<dl>
  <dt>
    <code>number</code></dt>
  <dd>
    指定的参数。</dd>
</dl>
<h3 id="Description" name="Description">描述</h3>
<p><span style="font-family: 'Courier New', 'Andale Mono', monospace;">isFinite 是全局的方法,不与任何对象有关系。</span></p>
<p>你可以用这个方法来判定一个数字是否是有限数字。</p>
<p><span style="font-family: 'Courier New', 'Andale Mono', monospace;">isFinite 方法以它的参数的方式检查。如果参数是&nbsp;</span><span style="font-family: 'Courier New', 'Andale Mono', monospace; line-height: inherit;">NaN, 正无穷大或者负无穷大,会返回false,</span><span style="line-height: inherit;">其他返回&nbsp;</span><span style="line-height: inherit; font-family: 'Courier New', 'Andale Mono', monospace;">true</span></p>
<p><span style="font-family: Georgia, Times, 'Times New Roman', serif; font-size: 1.428em; line-height: inherit;">示例</span></p>
<h4 id="Example:_Using_isFinite" name="Example:_Using_isFinite">Example: Using <code>isFinite</code></h4>
<p>你可以检查客户端的输入域是否是有限数字</p>
<pre class="eval">
if (isFinite(ClientInput)) {
   /* take specific steps */
}
</pre>
<h3 id="See_also" name="See_also">查看更多阅读</h3>
<p><a href="/en/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY" title="en/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY">Number.NEGATIVE_INFINITY</a>, <a href="/en/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY" title="en/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY">Number.POSITIVE_INFINITY</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>{{ languages( { "es": "es/Referencia_de_JavaScript_1.5/Funciones_globales/isFinite", "fr": "fr/R\u00e9f\u00e9rence_de_JavaScript_1.5_Core/Fonctions_globales/isFinite", "ja": "ja/Core_JavaScript_1.5_Reference/Global_Functions/isFinite", "pl": "pl/Dokumentacja_j\u0119zyka_JavaScript_1.5/Funkcje/isFinite" } ) }}</p>
Revert to this revision