Math PI Property - Javascript Math

Javascript examples for Math:PI

Description

The PI property returns the PI value, approximately 3.14

Return Value:

A Number, representing PI

The following code shows how to return PI:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {/*from  ww  w.j a  v  a2 s .  c  o  m*/
    document.getElementById("demo").innerHTML = Math.PI;
}
</script>

</body>
</html>

Related Tutorials