Learn to learn to make up, for the new permission logic has a lot of technology needs to use, a new round of complement.

The Math object

Math objects are not classes of objects like Date and String, so there is no constructor for Math(), and functions like math.sin () are just functions, not methods of an object. Without creating it, you can invoke all of Math’s properties and methods by using it as an object.

attribute

  • E: Returns the arithmetic constant E, the base of the natural logarithm (approximately equal to 2.718).
Math.E / / 2.718281828459045
Copy the code
  • LN2: returns the natural logarithm of 2 (approximately 0.693).
Math.LN2 / / 0.6931471805599453
Copy the code
  • LN10: Returns the natural log of 10 (approximately equal to 2.302).
Math.LN10 / / 2.302585092994046
Copy the code
  • LOG2E: Returns the log base 2 of e (approximately equal to 1.414).
Math.LOG2E / / 1.4426950408889634
Copy the code
  • LOG10E: returns the logarithm base 10 of e (approximately equal to 0.434).
Math.LOG10E / / 0.4342944819032518
Copy the code
  • PI: Returns the value of PI (approximately 3.14159).
Math.PI / / 3.141592653589793
Copy the code
  • SQRT1_2: returns the reciprocal of the square root of 2 (approximately equal to 0.707).
Math.SQRT1_2 / / 0.7071067811865476
Copy the code
  • SQRT2: Returns the square root of 2 (approximately equal to 1.414).
Math.SQRT2 / / 1.4142135623730951
Copy the code

methods

  • Abs (x) : Returns the absolute value of the number.
  • Acos (x) : Returns the inverse cosine of the number.
  • Asin (x) : The arcsine of the return number.
  • Atan (x) : Returns the arctangent of x between -pi /2 and PI/2 radians.
  • Atan2 (y,x) : Returns the Angle from the X-axis to the point (x,y) (between -pi /2 and PI/2 radians).
  • Ceil (x) : The logarithm is rounded up.
  • Cosine (x) : the cosine of the return number.
  • Exp (x) : returns the exponent of e.
  • Floor (x) : Logarithms are rounded down.
  • Log (x) : The natural logarithm of the number returned (base E).
  • Max (x,y) : Returns the highest value of x and y.
  • Min (x,y) : Returns the lowest value of x and y.
  • Pow (x,y) : Returns x to the y power.
  • Random () : Returns a random number between 0 and 1.
  • Round (x) : Round the number to the nearest whole number.
  • Sin (x) : The sine of a return number.
  • SQRT (x) : returns the square root of the number.
  • Tan (x) : returns the tangent of the Angle.
  • ToSource () : Returns the source code for this object.
  • ValueOf () : returns the original valueOf the Math object.