Javascript Math - 8 Properties (Reference)

Tech:
Javascript
Since:
2 years ago
Views:
5

The Javascript Math object provides properties and methods for mathematical constants and functions. This object is a built-in object in the JavaScript.

Math Properties:

E

The E property represents the base of natural logarithms, e, approximately 2.718.

Math.E;
// 2.718281828459045

// Euler's number

PI

The PI property represents the ratio of the circumference of a circle to its diameter, approximately 3.14159.

Math.PI;
// 3.141592653589793

LN2

The LN2 property represents the natural logarithm of 2, approximately 0.693.

Math.LN2;
// 0.6931471805599453

// natural log of 2

LN10

The LN10 property represents the natural logarithm of 10, approximately 2.302.

Math.LN10;
// 2.302585092994046

// natural log of 10

LOG2E

The LOG2E property represents the base 2 logarithm of E, approximately 1.443.

Math.LOG2E;
// 1.4426950408889634

// base-2 log of E

LOG10E

The LOG10E property represents the base 10 logarithm of E, approximately 0.434.

Math.LOG10E;
// 0.4342944819032518

// base-10 log of E

SQRT1_2

The SQRT1_2 property represents the square root of 1/2, approximately 0.707.

Math.SQRT1_2;
// 0.7071067811865476

// sqrt of 1/2

SQRT2

The SQRT2 property represents the square root of 2, approximately 1.414.

Math.SQRT2;
// 1.4142135623730951

// sqrt of 2