這是代表一個的值小于Number.MIN_VALUE一個特殊數值。此值被表示為“負無窮”。此值類似于在其數學行為的無窮大。例如,任何事情乘以NEGATIVE_INFINITY是NEGATIVE_INFINITY,以及任何除以NEGATIVE_INFINITY的值都為零。
因為NEGATIVE_INFINITY是一個常數,它是數的只讀屬性。
語法
您可以使用以下語法訪問屬性:
var val = Number.NEGATIVE_INFINITY;
示例 :
這里有一個例子說明這個屬性的用法:
<html><head><script type="text/javascript"><!--function showValue(){ var smallNumber = (-Number.MAX_VALUE) * 2 if (smallNumber == Number.NEGATIVE_INFINITY) { alert("Value of smallNumber : " + smallNumber ); }}//--></script></head><body><p>Click the following to see the result:</p><form><input type="button" value="Click Me" onclick="showValue();" /></form></body></html>
這將產生以下結果:
Value of val : -Infinity
新聞熱點
疑難解答