CancelImage Upload

How to load and return PI in JavaScript

If you are in need of PI within your JavaScript code, and do not feel like having to enter the exact number every time you require it's services, you need not worry. Here's is an easy way of accessing it:

var pi = Math.PI;

Here a more extended HTML example which Prints Pi to a HTML document:

<title>How to return PI in JavaScript</title>
<script language="JavaScript">

function printPi()

       var pi = Math.PI;

       document.write("PI = " + pi);


<body onload="javascript:printPi();">


Piece of cake!

Want to leave a comment?

No problem. Just enter your email and password below.

register | home | reminder

myDesignTool Networking •