Home »
JavaScript
Math.PI Property with Example in JavaScript
JavaScript | Math.PI Property: Here, we are going to learn about the PI Property of Math class in JavaScript with Examples.
Submitted by Shivang Yadav, on February 03, 2020
JavaScript | Math.PI Property
Math.PI is a property in math library of JavaScript that is used to find the value of PI(π) which is a mathematical constant whose value is 3.141. It is generally used to solve problems related to circular figures.
Syntax:
Math.PI
Parameter(s):
Return value:
The return type of this method is number, it returns the value of PI(π).
Browser support: Chrome, Internet explorer, Mozilla, Safari, Opera mini.
Example 1:
console.log(Math.PI);
Output
3.141592653589793
Example 2: Invalid values
console.log(Math.PI("Javascript"));
Output
Uncaught TypeError: Math.PI is not a function
at <anonymous>:1:18
JavaScript Math Object Methods »