aboutsummaryrefslogtreecommitdiff
path: root/files/zh-tw/conflicting/web/javascript/guide/functions_b2cd05cbfe188215dc2e3f972d293ed6/index.html
blob: db213a465e6e630f0561034f95f660f320ad653a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
---
title: isFinite 函數
slug: >-
  Web/JavaScript/Obsolete_Pages/Obsolete_Pages/Obsolete_Pages/預先定義的函數/isFinite_函數
translation_of: Web/JavaScript/Guide/Functions
translation_of_original: Web/JavaScript/Guide/Obsolete_Pages/Predefined_Functions/isFinite_Function
---
<p> </p>
<div class="onlyinclude">
<h4 id="isFinite_函數">isFinite 函數</h4>
<p><code>isFinite</code> 函數會對參數求值,來判斷是否是有限的數字。<code>isFinite</code> 的語法如下︰</p>
<pre>isFinite(number)
</pre>
<p>此處的 number 就是要求值的數字。</p>
<p>如果參數是 <code>NaN</code>、正無限大、負無限大,這個方法就會返回 <code>false</code>,否則就會返回 <code>true</code></p>
<p>以下的代碼會檢查客戶端的輸入,來判斷是否是有限的數字。</p>
<pre>if(isFinite(ClientInput))
{
   /* 適當的處理 */
}
</pre>
</div>
<p>{{ PreviousNext("Core_JavaScript_1.5_教學:預先定義的函數:eval_函數", "Core_JavaScript_1.5_教學:預先定義的函數:isNaN_函數") }}</p>
<p>{{ languages( { "en": "en/Core_JavaScript_1.5_Guide/Predefined_Functions/isFinite_Function", "fr": "fr/Guide_JavaScript_1.5/Fonctions_pr\u00e9d\u00e9finies/La_fonction_isFinite", "ja": "ja/Core_JavaScript_1.5_Guide/Predefined_Functions/isFinite_Function", "pl": "pl/Przewodnik_po_j\u0119zyku_JavaScript_1.5/Funkcje_predefiniowane/Funkcja_isFinite" } ) }}</p>