There are several constants used in JavaScript which we can use in our calculation. Let us see how to calculate the perimeter of a circle of radius 2 meter.
document.write ( " Perimeter of a circle of diameter 2 meter = " + Math.PI*2 + " meter ");
Output of this is here
Perimeter of a circle of diameter 2 meter = 6.283185307179586 meter
There are few more constants and here is the list.
Constants
Description
Math.PI
Value is 3.141592653589793. This is the value of PI used trigonometry
Math.E
Value is 2.718281828459045, known as Euler's constant
Math.LN2
Equal to 0.6931471805599453, natural logarithm of 2
Math.LN10
Equal to 2.302585092994046 natural logarithm of 10
Math.LOG2E
Equal to 1.4426950408889633 base 2 logarithm of E
Math.LOG10E
Equal to 0.4342944819032518 base 10 logarithm of E