# Math object in JavaScript

## The Math object gives you properties and methods for constants and mathematical functions. Unlike other Global objects, Math is not a constructor. All properties and methods of Math are static (Static) and can be called using Math as an object without having to create it.

The Math object gives you properties and methods for constants and mathematical functions. Unlike other Global objects, Math is not a constructor. All properties and methods of Math are static (Static) and can be called using Math as an object without having to create it.

So, you refer to the constant pi as Math.PI and you call the sine function as Math.sin (x) , where x is the parameter of the method.

Syntax

The syntax for calling properties and methods of Math is as follows:

` var  pi_val  = Math . PI ; var  sine_val  = Math . sin ( 30 ); `

## Math properties

The table below lists the properties of Math and describes it.

Attribute DescriptionE The E constant, and the base of the natural algorithm (symbol: ln), approximately 2.718 LN2 Natural logarithm of 2, approximately 0.693. LN10 Natural logarithm of 10, approximately 2,302. LOG2E Base 2 Logarithm of E, approximately 1,442. LOG10E Logarithm base 10 of E, approximately 0.434. PI Pi coefficient, approximately 3.14159. SQRT1_2 The square root of 1/2; approximately 0.707. SQRT2 The square root of 2, approximately 1,414.

## Math methods

The table below lists Math's methods and describes it.

Method Descriptionabs () Returns the absolute value of some acos () Returns arccos (radians value) of some asin () Returns arcsin (radians value) of some atan () Returns arctan (value radians) of some atan2 () Returns inverse trigonometric tang ceil () Returns the smallest integer number greater than or equal to a number cos () Returns cos of a number. exp () Returns E, where N is the parameter, and E is the Euler floor constant () Returns the largest integer smaller than or equal to a log number () Returns the base e-logarithm of a maximum number () Returns the maximum number of 0 or more min () Returns the smallest number of 0 or more pow numbers () Returns the value of (base) (exponent) . random () Returns a random number between two numbers 0 and 1. round () Rounds the number. Returns the value of the nearest integer. sin () Returns the sine of some sqrt () Returns the square root of some tan () Returns the tan of some toSource () Returns the "Math" string

According to Tutorialspoint

Previous article: Date object in JavaScript

Next lesson: Regular Expression and RegExp in JavaScript