Javascript - Math class reference

Introduction

You can use Math object to do mathematical calculation.

Property

PropertyDescription
Math E PropertyThe E property returns the Euler's number and the base of natural logarithms, approximately 2.718.
Math LN10 PropertyThe LN10 property returns the natural logarithm of 10, approximately 2.302.
Math LN2 PropertyThe LN2 property returns the natural logarithm of 2, approximately 0.693.
Math LOG10E PropertyThe LOG10E property returns the base-10 logarithm of E, approximately 0.434.
Math LOG2E PropertyThe LOG2E property returns the base-2 logarithm of E, approximately 1.442.
Math PI PropertyThe PI property returns the ratio of a circle's area to the square of its radius, approximately 3.141592
Math SQRT1_2 PropertyThe SQRT1_2 property returns the square root of 1/2, approximately 0.707.
Math SQRT2 PropertyThe SQRT2 property returns the square root of 2, approximately 1.414.

Method

MethodDescription
Math abs() MethodThe abs() method returns the absolute value of a number.
Math acos() MethodThe acos() method returns the arccosine of a number as a value value between 0 and PI radians.
Math acosh() MethodThe acosh() method returns the hyperbolic arccosine of a number.
Math asin() MethodThe asin() method returns the arcsine of a number as a value between -PI/2 and PI/2 radians.
Math asinh() MethodThe asinh() method returns the hyperbolic arcsine of a number.
Math atan() MethodThe atan() method returns the arctangent of a number as a value between -PI/2 and PI/2 radians.
Math atan2() MethodThe atan2() method returns the arctangent of the quotient of its arguments, between PI and -PI radians.
Math atanh() MethodThe atanh() method returns the hyperbolic arctangent of a number.
Math cbrt() MethodThe cbrt() method returns the cubic root of a number.
Math ceil() MethodThe ceil() method rounds a number UPWARDS to the nearest integer, and returns the result.
Math cos() MethodThe cos() method returns the cosine of a number.
Math cosh() MethodThe cosh() method returns the hyperbolic cosine of a number.
Math exp() MethodThe exp(x) method returns the value of E^x, where E is Euler's number (approximately 2.7183).
Math floor() MethodThe floor() method rounds a number downwards to the nearest integer, and returns the result.
Math log() MethodThe log() method returns the natural logarithm (base E) of a number.
Math max() MethodThe max() method returns the number with the highest value.
Math min() MethodThe max() method returns the number with the highest value.
Math pow() MethodThe pow() method returns the value of x to the power of y (x^y).
Math random() MethodThe random() method returns a random number from 0 (inclusive) up to but not including 1 (exclusive).
Math round() MethodThe round() method rounds a number to the nearest integer.
Math sin() MethodThe sin() method returns the sine of a number.
Math sinh() MethodThe sinh() method returns the hyperbolic sine of a number.
Math sqrt() MethodThe sqrt() method returns the square root of a number.
Math tan() MethodThe tan() method returns a number that represents the tangent of an angle.
Math tanh() MethodThe tanh() method returns a number that represents the hyperbolic tangent of a number.
Math trunc() MethodThe trunc() method returns the integer part of a number.