# Javascript Math

In JavaScript, Math is a built-in object. It has both properties and methods for mathematical functions and constants.

Math operates with the Number type, but never with BigInt.

Unlike other global objects, Math is not considered a constructor. The methods and properties of Math are fixed. You can call them by applying Math as an object without creating it.

So, you refer to constant pi as Math.PI. Hence, the sine function should be called Math.sin(x). Here, x is the argument of the method.

The syntax to call the methods and properties of Math is the following:

``````var pi_value = Math.PI;
var sin_value = Math.sin(30);``````

Properties of Math

Now let’s check out the list of math properties with their descriptions.

Math.LN2

The natural logarithm of 2: nearly 0.693. Javascript math logarithm
console.log(Math.LN2);

Math.LN10

The natural logarithm of 10; nearly 2.303. Javascript math logarithm
console.log(Math.LN10);

Math.LOG2E

E’s base 2 logarithm; nearly 1.443. Javascript math logarithm
console.log(Math.LOG2E);

Math.LOG10E

E’s base 10 logarithm; nearly 0.434. Javascript math logarithm
console.log(Math.LOG10E);

Math.PI

The circumference ratio of a circle to its diameter ,nearly 3.14159. Javascript math pi
console.log(Math.PI);

Math.SQRT1_2

½ square root ( or correspondingly 1/√2); nearly 0.707. Javascript math square root
console.log(Math.SQRT1_2);

Math.SQRT2

The square root of 2; nearly 1.414. Javascript math square root
console.log(Math.SQRT2);

The Methods of Math

Below you will find the list of the math methods and their descriptions;

Math.abs(number)

This method is targeted at returning the absolute value of a number. Javascript math absolute value
console.log(Math.abs(-10)); console.log(Math.abs('-10')); console.log(Math.abs(-20 * 2));

Math.acos(number)

Returning the arccosine (in radians) of a number. Javascript math arccosine
console.log(Math.acos(0.75)); console.log(Math.acos(-0.9)); console.log(Math.acos(3));

Math.acosh(number)

Returning the hyperbolic arccosine of a number. Javascript math arccosine
console.log(Math.acosh(1)); console.log(Math.acosh(1.5)); console.log(Math.acosh(0.99));

Math.asin(number)

Returning the arcsine of a number. Javascript math asine
console.log(Math.asin(0.75)); console.log(Math.asin(-0.9)); console.log(Math.asin(2));

Math.asinh(x)

Returning the hyperbolic arcsine of a number. Javascript math asinh
console.log(Math.asinh(1)); console.log(Math.asinh(1.5)); console.log(Math.asinh(-2));

Math.atan(x)

Returning the arctangent of a number. Javascript math arctangens
console.log(Math.atan(0.75)); console.log(Math.atan(-0.9)); console.log(Math.atan(2));

Math.floor(x)

Returning the largest integer that is less than or equal to a number. Javascript math floor
console.log(Math.floor(2.65)); console.log(Math.floor(7.1)); console.log(Math.floor(5.8));

Math.pow(x, y)

Returns the exponent power base, which is xy. Javascript math round
console.log(Math.pow(3, 3)); console.log(Math.pow(4, 2)); console.log(Math.pow(2, 5));

Math.round(x)

Returning a number’s value rounded to the nearest integer. Javascript math round
console.log(Math.round(32.65)); console.log(Math.round(7.4)); console.log(Math.round(6.1));

Math.sin(x)

Returning a number’s sine. Javascript math sin
console.log(Math.sin(2)); console.log(Math.sin(0)); console.log(Math.sin(-1));

Math.sqrt(x)

Returning the positive square root of a number. Javascript math sqrt
console.log(Math.sqrt(81)); console.log(Math.sqrt(16)); console.log(Math.sqrt(-4));
 Math.E Euler’s constant as well as natural logarithms’ base; nearly 2.718. Math.atanh(x) Returning the hyperbolic arctangent of a number. Math.atan2(y, x) Returning the arctangent of its arguments’ quotient. Math.cbrt(x) Returning a number’s cube root. Math.ceil(x) Returning the smallest integer that is greater than or equal to a number. Math.clz32(x) Returning the number of leading a 32-bit integer zeros. Math.cos(x) Returning the cosine of a number. Math.cosh(x) Returning a number’s hyperbolic cosine. Math.exp(x) Returning Ex, where x is the argument, and E is Euler's constant (2.718…, the natural logarithm base). Math.expm1(x) Returning subtracting 1 from exp(x). Math.fround(x) Returning a number’s nearest single-precision float representation. Math.hypot([x[, y[, …]]]) Returning the square root of the sum of squares of its arguments. Math.imul(x, y) Returning a 32-bit integer multiplication result. Math.log(x) Returning a number’s natural logarithm (㏒e; also, ㏑). Math. (x) Returning the natural logarithm (㏒e; also ㏑) of 1 + x for a number. Math.log10(x) Returning a number’s base 10 logarithm. Math.log2(x) Returning a number’s base 2 logarithm. Math.max([x[, y[, …]]]) Returning the largest of zero or more numbers. Math.min([x[, y[, …]]]) Returning the smallest of zero or more numbers. Math.random() Returning a pseudo-random number between 0 and 1. Math.sign(x) Returning the x sign, indicating whether x is positive, negative, or zero. Math.sinh(x) Returning a number’s hyperbolic sine. Math.tan(x) Returning a number’s tangent. Math.tanh(x) Returning the hyperbolic tangent of a number. Math.toSource() Returning the string "Math". Math.trunc(x) Returning the integer part of the number x and removing each fractional digit.