There are also some properties and methods for the built-in math math entries and functions. For example, the Pi property of the Math object will have the property value Pi (3.141 ...), and you can call it like this:
Similarly, standard mathematical functions are the math method. These include trigonometric, logarithmic, exponential, and other functions. Let's say you want to use a trigonometric sin, you can write this:
It should be noted that all trigonometric parameters of math are in radians.
Unlike other objects, you cannot create a math object of your own. You can only use the built-in math object.
eg
1.min () and Max ( )
var value = [1,2,3,4,5,6,7,8];
var max = Math.max.apply (Math, values);
2. Rounding Method
Math.ceil (): Rounding up
Math.floor (): Rounding Down
Math.Round (): Rounding
3.random ()
the Math.random () method returns a random number between 0 and 1, excluding 0 and 1
var num = Math.floor (Math.random () *10, + 1)//Returns the number between 1-10
4.round ()
How to use round ().
5.random ()
How to use random () to return a random number between 1 and 0.