Math and its common methods

1.Math function, but it belongs to object type

typeof Math => "object"
Copy the code

Math functions are called Math functions because the Math object provides many methods for manipulating numbers

Ceil/floor: round up/down

Round: round

Max/min: Sets the maximum and minimum values

sqrt: open square

Pow: to the power (N to the M)

The console. The log (2, 10); / / = > 1024Copy the code

PI: obtains the value of PI

Random: Obtains a random decimal number between 0 and 1

Math.round(math.random ()*(m-n)+n): Obtains a random integer between n and m