Math Object Constants

How to get the value of constants like PI, Eulers in javascript?


Object: Math Variables
Math object has the following variables that give the values of constants like PI, logarithm, Eulers, etc..
ConstantExample CodeResultDescription
E Math.E; Math.E returns the Eulers constant.
LN2 Math.LN2; Math.LN2 returns the value of natural logarithm of base 2.
LN10 Math.LN10; Math.LN10 returns the constant value of natural logarithm to the base 10.
LOG2E Math.LOG2E; Math.LOG2E returns the logarithmic value of E to the base 2.
LOG10E Math.LOG10E; Math.LOG10E returns the logarithmic value of E to the base 10.
PI Math.PI; Math.PI returns the value of constant PI.
SQRT1_2 Math.SQRT1_2; Math.SQRT1_2 returns the Square Root of 0.5.
SQRT2 Math.SQRT2; Math.SQRT2 returns the value of Square Root of 2.

Ask Questions

Ask Question