Using Math.PI property to coding in Javascript/JS

This JavaScript tutorial explains how to use the math property referred to as Math.PI with syntax and examples.


In JavaScript, Math.PI is a math property that is used to return the mathematical steady π (pi). Because Math.PI is a property of the Math object, it must be invoked thru the placeholder object known as Math.


In JavaScript, the syntax for the Math.PI property is:


Parameters or Arguments

There are no parameters or arguments for the Math.PI property.


The Math.PI property returns the mathematical steady π (pi) which has an approximate fee of 3.141592653589793.


The Math.PI property is a property of the Math object and now not a math function. However, we have blanketed the Math.PI property within our JS Math Functions area because you will most in all likelihood use this property in conjunction with the Math functions found in this section.


Let’s take a look at an example of how to use the Math.PI property in JavaScript.

For example:


In this example, we have invoked the Math.PI property using the Math class.

We have written the output of the Math.PI property to the net browser console log, for demonstration purposes, to exhibit what the Math.PI property returns.

The following will be output to the web browser console log:


In this example, the Math.PI property back a fee of 3.141592653589793 which is the fee of the mathematical regular π or pi.