The Math object is to perform mathematical operation on client side in JavaScript.
var x = Math.PI; // Returns PI
var y = Math.sqrt(16); // Returns the square root of 16
Let have some detailed information about JavaScript Math Object:
JavaScript abs() Method
Math.abs(-2.57); // 2.57
JavaScript acos() Method
Math.acos(0.3); //1.2661036727794992
JavaScript asin() Method
Math.asin(0.5); //0.5235987755982989
JavaScript atan() Method
Math.atan(2); //1.1071487177940904
JavaScript atan2() Method
Math.atan2(8,4); //1.1071487177940904
JavaScript ceil() Method
Math.ceil(1.4); //2
JavaScript cos() Method
Math.cos(3); // -0.9899924966004454
JavaScript exp() Method
Math.exp(1); // 2.718281828459045
JavaScript floor() Method
Math.floor(1.6); // 1
JavaScript log() Method
Math.log(2); //0.6931471805599453
JavaScript max() Method
Math.max(5,10); //10 minimum value from 5,10
JavaScript min() Method
Math.max(5,10); //5 maximum value from 5,10
JavaScript pow() Method
Syntax: Math.pow(x,y) Where, x = The base , y = The exponent
Math.pow(3,2); //9
JavaScript random() Method
Return a random number between 0 (inclusive) and 1 (exclusive) :
Math.random();
JavaScript round() Method
Math.round(2.5); // 3
JavaScript sin() Method
This method returns a value between -1 and 1, which represents the sine of the parameter x.
Math.sin(3); //0.1411200080598672
JavaScript sqrt() Method
Math.sqrt(9); // 3
JavaScript tan() Method
Math.tan(90); // -1.995200412208242