Home >>JavaScript Math Reference >JavaScript PI Property
JavaScript PI property is used to return the ratio of a circle's area to the square of its radius. Its value is approximately 3.14.
Syntax:
Math.PI
Property | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
PI | Yes | Yes | Yes | Yes | Yes |
Here is an example of JavaScript PI property:
<html> <body> <p>Click the button to see the Output.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("demo").innerHTML = Math.PI; } </script> </body> </html>
Click the button to see the Output.