Math.PI

Did you know that you can read content offline by using one of these tools? If you would like to read offline MDN content in another format, let us know by commenting on Bug 665750.

Dash App

概要

円周率。約 3.14159 です。

Math のプロパティ(静的、読取専用)
実装されたバージョン JavaScript 1.0
ECMAScript エディション ECMA-262

構文

Math.PI

詳細

PI は、静的なプロパティなので、自ら生成した Math オブジェクトのプロパティとしてではなく、常に、Math.PI として使用するようにしてください。

例

例: PI の使用

円周率の値を返す関数を作成し、アラートで表示する例を示します。

function getPI() {
   return Math.PI;
}

alert( getPI() );

タグ (2)