English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

The JavaScript Math.PI Property

 JavaScript Math Object

The Mth.PI property represents the ratio of the circumference of a circle to its diameter, approximately.3.14159.

Since PI is a static property of Math, you always use it asMath.PI,not used as a property of the Math object created.

Syntax:

Math.PI
Math.PI;
Test and see‹/›

Browser Compatibility

All browsers fully support the Math.PI property:

Property
Math.PIYesYesYesYesYes

Technical Details

Writable:None
Enumerable:None
Configurable:None
Return Value:The numerical representation of PI
JavaScript Version:ECMAScript 1

More Examples

Calculate the circumference of a circle through the radius:

function getCircumference(radius) {
   return (2 * Math.PI * radius);
}
getCircumference(5);
Test and see‹/›

Calculate the area of a circle through the radius:

function getArea(radius) {
   return (Math.PI * radius * radius);
}
getArea(5);
Test and see‹/›

 JavaScript Math Object