Math Methods or Function

how to do math calculations in javascript?
what are the methods to do mathematical operations in javascript?


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()
To call a math method, just use the name Math followed by its method name, separated by a dot.


This method call generates a random number.

Math object can be categorized as
Basic Math Functions

Trigonometric Functions

Math Variables or Constants

Ask Questions

Ask Question