グローバルプロパティ Infinity は無限大を表す数値です。
Infinity のプロパティ属性 |
|
|---|---|
| 書込可能 | 不可 |
| 列挙可能 | 不可 |
| 設定可能 | 不可 |
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
構文
Infinity
説明
Infinity はグローバルオブジェクトのプロパティです。言い換えればグローバルスコープ内の変数です。
Infinity の初期値は Number.POSITIVE_INFINITY です。Infinity という値(正の無限大)は他のあらゆる数より大きい数です。この値は数学的に無限大のように振る舞います。例えば、Infinity を掛けたものは全て Infinity となり、Infinity で割ったものは全て 0 となります。
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 */
仕様
| 仕様書 | 状況 | コメント |
|---|---|---|
| ECMAScript 1st Edition (ECMA-262) | 標準 |
初期定義。 |
| ECMAScript 5.1 (ECMA-262) Infinity の定義 |
標準 | |
| ECMAScript 2015 (6th Edition, ECMA-262) Infinity の定義 |
標準 | |
| ECMAScript Latest Draft (ECMA-262) Infinity の定義 |
ドラフト |
ブラウザー実装状況
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
| デスクトップ | モバイル | サーバー | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Infinity | Chrome 完全対応 1 | Edge 完全対応 12 | Firefox 完全対応 1 | IE 完全対応 4 | Opera 完全対応 あり | Safari 完全対応 あり | WebView Android 完全対応 1 | Chrome Android 完全対応 18 | Firefox Android 完全対応 4 | Opera Android 完全対応 あり | Safari iOS 完全対応 あり | Samsung Internet Android 完全対応 1.0 | nodejs 完全対応 あり |
凡例
- 完全対応
- 完全対応