JavaScript (ES2026) reference · Math Methods and Constants
JavaScript Math.PI Property
The ratio of a circle's circumference to its diameter, approximately 3.14159.
JavaScript (ES2026) Since ES1
Syntax
Math.PI
Return value
3.141592653589793
Examples
console.log(Math.PI);
Output
3.141592653589793
const r = 2;
console.log((Math.PI * r ** 2).toFixed(2), (2 * Math.PI * r).toFixed(2));
Output
12.57 12.57
Version history
| Version | Change |
|---|---|
| JavaScript ES1 | Added |
Related
Math.E· Euler's number, the base of natural logarithms, approximately 2.71828.Math.sin()· Return the sine of an angle given in radians. Convert degrees with deg * Math.PI / 180 first.- JavaScript Math · tutorial
- JavaScript Numbers · tutorial