Skip to content
Related Articles
ES6 | Math
• Last Updated : 28 Oct, 2019

The ES6 Math contains so many properties and methods to perform some mathematical functions. The ES6 is an object that can be called without creating it. With the help of ES6 Math in JavaScript, you can store integers in the form of binary and octal notation. There are so many properties and functions are available in ES6 Math. Also in the function section, there are lots of variety of functions mentioned below.

ES6 Math() Functions type:

• Exponential Functions
• Logarithmic Functions
• Miscellaneous Algebraic Functions
• Trigonometric Functions

ES6 Math properties list with there brief description:

PropertyDescription
Math-E PropertyThis property define the Euler’s constant(2.718)
Math-LN2 PropertyThis property defines the natural log2(0.693)
Math-LN10 PropertyThis property defines the natural log10(2.302)
Math-LOG2E PropertyThis property defines the base 2 logarithm of E(1.442)
Math-LOG10E PropertyThis property defines the base 10 logarithm of E(0.434)
Math-PI PropertyThis property defines the ratio of the circumference of a circle to its diameter(3.14159)
Math-SQRT1_2 PropertyThis property defines the square root of 1/2(0.707)
Math-SQRT2 PropertyThis property defines the square root of 2(1.414)

ES6 Math Exponential Functions: There are so many functions for like square root, cube root, and powers of e, as shown in the below table. The Math.pow() is the basic function of the Exponential Functions.

FunctionDescription
Math.Pow() FunctionThis function returns the base to the exponent power.
Math.sqrt() FunctionThis function returns the square root of a number.
Math.cbrt() FunctionThis function returns the cube root of a number.
Math.exp() FunctionThis function is equivalent to Math Pow() Function.
Math.expm1(X) FunctionThis function is equivalent to Math exp()-1.
Math.hypot(x1, x2, …) FunctionThis function returns the square root of the sum of the arguments.

ES6 Math Logarithmic Functions: In the Logarithmic section there are 4 functions but the basic one is Math.log() function, this is natural logarithmic. The ES6 introduce the Math.log10() function in JavaScript before ES6 there is no log10 in the entire JavaScript.

FunctionDescription
Math.log(x) FunctionThis function returns the natural logarithm of X.
Math.log10(x) FunctionThis function returns the base 10 logarithm of X.
Math.log2(x) FunctionThis function returns the base 2 logarithm of X.
Math.log1p(x) FunctionThis function returns the natural logarithm of 1+x.

ES6 Math Miscellaneous Algebraic Functions: There are lots of functions in this section mentioned below with the brief description.

FunctionDescription
Math.abs() FunctionThis functions returns the exact value of the number.
Math.sign() FunctionThis functions returns the sign of the exact number.
Math.ceil() FunctionThis function returns the smallest integers greater than or equal to the exact number mens the ceiling value.
Math.floor() FunctionThis function returns the floor value of the exact number.
Math.trunc() FunctionThis function retunrs the trim value of exact number means remove the decimel right digit.
Math.round() FunctionThis function returns the rounds of the exact number.
Math.min() FunctionThis function returns the smallest of zero or more numbers if no arguments are given the it will return the +infinity.
Math.max() FunctionThis function returns the largest of zero or more numbers if no arguments are given the it will return the -infinity.

ES6 Math Trigonometric Functions: There are lots of functions in Trigonometric Functions but all the functions deals with the radians but the degree is not valid in this section.

FunctionDescription
Math.sin() FunctionThis function return the sin of exact number.
Math.cos() FunctionThis function return the cosine of exact number.
Math.tan() FunctionThis function return the tangent of exact number.
Math.asin() FunctionThis function return the inverse sin of exact number.
Math.acos() FunctionThis function return the inverse cosine of exact number.
Math.atan() FunctionThis function return the inverse tangent of exact number.
Math.atan2() FunctionThis function returns a numeric value between -pi and pi representing the angle theta of exact two point.

There is one more function which doesn’t belongs to any above mentioned categories that is Math.random() function. This function returns the random number between 0 and 1.
Below example illustrate the function:
Example:

 ``

Output

`The random function value : 0.603934617864549`

Note: The Edge and the Safari is the first two browser that support all the ES6 features.
Supported Browsers: The browsers supported by ES6 Math are listed below:

• Google Chrome
• Internet Explorer
• Firefox
• Safari
• Opera
My Personal Notes arrow_drop_up