Object: Math
Math object contains the methods or function that can be used to
easily do mathematical calculations. Math object is an in built object and so it is not required
to instantiate the object as done for Date object. Math also contains pre-defined variables that will
give values of important constants like Pi, LN2, log base 10 etc...
To use math object:
Syntax: Math.methodName()
Explanation:
To call a math method, just use the name Math followed by its method name, separated by a dot.
Example: Math.random()
This method call generates a random number.
Math object can be categorized as
Basic Math Functions
Trigonometric Functions
Math Variables or Constants
|