Math Properties: The Following Table Lists The Standard Properties of The Math Object
Math Properties: The Following Table Lists The Standard Properties of The Math Object
The following table lists the standard properties of the Math object.
Property Description
E Returns Euler's number, the base of natural logarithms, e, approximately 2.718
LN2 Returns the natural logarithm of 2, approximately 0.693
LN10 Returns the natural logarithm of 10, approximately 2.302
LOG2E Returns the base 2 logarithm of e, approximately 1.442
LOG10E Returns the base 10 logarithm of e, approximately 0.434
PI Returns the ratio of the circumference of a circle to its diameter (i.e. π). The approximate value of PI
is 3.14159
SQRT1_2 Returns the square root of 1/2, approximately 0.707
SQRT2 Returns the square root of 2, approximately 1.414
Note: The Math object is just a collection of static functions and constants. The
Math object is different from other built-in objects (e.g. Date, Array, String, etc.),
because it has no constructor, so there is no way to create an instance of Math.
Math Methods
The following table lists the standard methods of the Math object.
Method Description
floor() Returns the next integer less than or equal to a given number (rounding down).
random() Returns a random number between 0 and 1 (including 0, but not 1).
trunc(x) Returns the integer part of a number by removing any fractional digits.