Core JavaScript 1.5 Reference:Global Objects:Math:PI
From MDC
Contents |
[edit] Summary
The ratio of the circumference of a circle to its diameter, approximately 3.14159.
| Property of Math | |
|
Static, Read-only |
|
| Implemented in: | JavaScript 1.0, NES 2.0 |
| ECMA Version: | ECMA-262 |
[edit] Description
Because PI is a static property of Math, you always use it as Math.PI, rather than as a property of a Math object you created.
[edit] Examples
[edit] Example: Using PI
The following function returns the value of pi:
function getPi() {
return Math.PI
}