J

JavaScript Handbook

Clean • Professional

Math Object

3 minute

Math Object 

The JavaScript Math object is a built-in, static object that provides mathematical constants (properties) and methods for performing calculations like arithmetic, trigonometry, logarithms, and random number generation. Unlike the Number object, Math is not a constructor (you don’t use new Math()), and all its properties and methods are accessed directly via Math.<property> or Math.<method>().

Math Object Properties

These are static constants representing fundamental mathematical values, all in double-precision floating-point format.

learn code with durgesh images

Math.E: Base of natural logarithms (Euler’s number). Useful for exponential growth and decay calculations.

Example:

console.log(Math.E); // 2.718281828459045

Math.LN2: Natural logarithm of 2. Often used in logarithmic calculations.

Example:

console.log(Math.LN2); // 0.6931471805599453

Math.LN10: Natural logarithm of 10. Useful in scientific and engineering calculations.

Example:

console.log(Math.LN10); // 2.302585092994046

Math.LOG2E: Base-2 logarithm of Math.E. Helps in calculations involving powers of 2.

Example:

console.log(Math.LOG2E); // 1.4426950408889634

Math.LOG10E: Base-10 logarithm of Math.E. Useful in base-10 logarithmic conversions.

Example:

console.log(Math.LOG10E); // 0.4342944819032518

Math.PI: The constant π (pi), used in geometry, circles, and trigonometry.

Example:

console.log(Math.PI); // 3.141592653589793
let radius = 5;
console.log(2 * Math.PI * radius); // Circumference → 31.41592653589793

Math.SQRT1_2: Square root of 1/2 (~0.707). Useful in normalized vector calculations.

Example:

console.log(Math.SQRT1_2); // 0.7071067811865476

Math.SQRT2: Square root of 2 (~1.414). Common in geometry and diagonal calculations.

Example:

console.log(Math.SQRT2); // 1.4142135623730951

Summary Table

NameDescriptionApproximate Value
Math.EBase of natural logarithms (e)2.718281828459045
Math.LN2Natural logarithm of 20.6931471805599453
Math.LN10Natural logarithm of 102.302585092994046
Math.LOG2EBase-2 logarithm of Math.E1.4426950408889634
Math.LOG10EBase-10 logarithm of Math.E0.4342944819032518
Math.PIThe constant π (pi)3.141592653589793
Math.SQRT1_2Square root of 1/20.7071067811865476
Math.SQRT2Square root of 21.4142135623730951Math Object Methods


Article 0 of 0