Math is called a mathematical function, but it is of object type

typeof Math -> ‘object’

They are called mathematical functions because the Math object provides many ways to manipulate numbers

Common methods provided in Math math.xxx (n)

abs:Take the absolute value,

ceil/floor:Round up/down

Math.ceil(10.01) = >11
Math.ceil(-10.01) = > -10

Math.floor(10.99) = >10
Math.floor(-10.99) = > -11
Copy the code

round:Round (positive.5 up, negative.5 down)

sqrt:Open square

pow:To the power of n to the m.

Math.pow(2.10) = >1024
Copy the code

max/min:Take the maximum, take the minimum

Math.max(1.2.3.4)   / / 4
Math.min(1.2.3.4)   / / 1
Copy the code

PI:Get PI

The random:Gets a random decimal between 0 and 1

Math.round(math.random ()*(m-n)+n) : Returns a random positive integer between n->m