In JavaScript, Math is a built-in object that gives you common math constants
And functions like rounding, square root, power, and random numbers.
It is not a normal object you create with new;
you use it directly like Math.PI or Math.sqrt(25)
Simple idea
Math.PIgives the value ofpiMath.round(4.6)gives5Math.floor(4.9)gives4Math.ceil(4.1)gives5Math.sqrt(25)gives5Math.pow(2, 3)gives8Math.random()gives a random decimal between0and1
Example

Top comments (0)