JavaScript Tutorial





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Java-Script Tutorial
Introduction Introduction
Variables Variables
Operators Operators
Statements Statements
Loops Loops
Functions Functions
Objects Objects
Arrays Arrays
Cookies JS Cookies
Browser Objects Browser Objects
Form DOM Form DOM
Style Objects DOM Style Objects
Forums Ask Your Doubts
Scraps More about Javascript
Feedback Feedback
 




Math Object Constants


Tutorials Javascript

Topic

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



Explanation

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.





A Note
Javascript (JS) is one of the most used languages in the world. Some times spelled as Java Script. Hope you enjoy this tutorial. Do send your feedback or suggestions on this javascript or java script tutorial. This is a copyright content.

Other Links

web hosting