How to use Math

Math Object Properties

Math has mathematical formulas and information.

PROPERTYValueDESCRIPTION
Math.E2.718281828459045091The value of e, the base of the natural logarithms
Math.LN102.302585092994045901 The natural logarithm of 10
Math.LN20.6931471805599452862The natural logarithm of 2
Math.LOG2E1.442695040888963387The base 2 logarithm of e
Math.LOG10E0.4342944819032518167The base 10 logarithm of e
Math.PI3.141592653589793116The value of pMath.SQRT1_2 The square root of 1/2
Math.SQRT21.414213562373095145 The square root of 2

Math Object Methods

METHODDESCRIPTION
Math.abs(num)Returns the absolute value of (num)
Math.acos(x)Returns the arc cosine of x
Math.asin(x)Returns the arc sine of x
Math.atan(x)Returns the arc tangent of x
Math.atan2(y, x)Returns the arc tangent of y/x
Math.ceil()the ceiling function.
Math.cos(x)Returns the cosine of x
Math.exp(num)Returns Math.E raised to the power of (num)
Math.floor()the floor function.
Math.log(num)Returns the natural logarithm of (num)
Math.maxReturns the maximun value in the list
Math.minReturns the minimun value in the list
Math.pow(num,power)Returns num raised to the power of power
Math.random()returns a random number between the 0 and the 1, not including either 0 or 1.
Math.round()a round function.
Math.sin(x)Returns the sine of x
Math.sqrt(num)Returns the square root of (num)
Math.tan(x)Returns the tangent of x




















Home »
  Javascript »
    Javascript Reference »




Array
Canvas Context
CSSStyleDeclaration
CSSStyleSheet
Date
Document
Event
Global
History
HTMLElement
Input Element
Location
Math
Number
String
Window