Math mathematical objects

1.Math.ceil (num); rounding up.
Math.floor (num); rounded down.
Math.round (num); rounding.

2.Math.max (num1, num2, ......) ; takes the maximum value.
Math.min (num1, num2, ......) ; a minimum value.

3.Math.pow (num1, num2); // num1 as the base, the number num2 power, i.e. ^ num2 num1;
the Math.sqrt (n-); // square root, i.e. n ^ (1/2)

4.Math.abs (n); // absolute value.

5.Math.random (); // a random number 0-1;
Math.random () * 10 + 10; // range: 10-20;
range: XY
Math.random () * (YX) + X;

Guess you like

Origin blog.51cto.com/11569511/2417742
Recommended