Welcome to Bucaro TecHelp!

Bucaro TecHelp
HTTPS Encryption not required because no account numbers or
personal information is ever requested or accepted by this site

About Bucaro TecHelp About BTH User Agreement User Agreement Privacy Policy Privacy Site Map Site Map Contact Bucaro TecHelp Contact RSS News Feeds News Feeds

JavaScript Math Object

The JavaScript Math object gives you powerful routines that let you find Square root, logarithms, raise a number to a power, perform trigonometric functions and much more. In addition it provides several properties, such as the value of natural logarithm e, and the value of pi.

Math Object Properties

Property Value Description
Math.E 2.718281828459045091 Natural log
Math.LN2 0.6931471805599452862 Natural log of 2
Math.LN10 2.302585092994045901 Natural log of 10
Math.LOG2E 1.442695040888963387 Base-2 log of e
Math.LOG10E 0.4342944819032518167 base-10 Log of e
Math.PI 3.141592653589793116 pi

Because these properties return their values, you can use them like constants in your mathematical expressions. For example, to obtain the circumference of a circle whose diameter is d, use the statement below:

circumference = d * Math.PI

Math Object Methods

Method Returns
Math.abs(value) Absolute value
Math.acos(value) Arc cosine in radians
Math.asin(value) Arc sine in radians
Math.atan(value) Arc tangent in radians
Math.atan2(value1, value2)Angle of polar coordinates x and y
Math.ceil(value) Next integer greater than or equal to value
Math.cos(value) Cosine
Math.exp(value) Raise log e to the power of value
Math.floor(value) Next integer less than or equal to value
Math.log(value) Natural logarithm (base e)
Math.max(value1, value2)The greater of value1 or value2
Math.min(vallue1, value2)The lesser of value1 or value2
Math.pow(vallue1, value2)Value1 to the value2 power
Math.random() Random number between 0 and 1
Math.round(value) value + 1 when value >= value.5 otherwise value
Math.sin(value) Sine in radians
Math.sqrt(value) Square root
Math.tan(value) Tangent

Most Math object methods take one or two values as parameters, the only Math object method that doesn't take a value as a parameter is the random method.

More Java Script Code:
• Java Script Math.sin Method
• Java Script Events
• Java Script confirm Message Box
• The while Loop
• The do/while Loop
• Java Script Reserved Words
• Format a Number as Currency
• The break Statement
• The Java Script window.open Method
• Access Web Page Elements With getElementById

RSS Feed RSS Feed

Follow Stephen Bucaro Follow @Stephen Bucaro


Fire HD
[Site User Agreement] [Privacy Policy] [Site map] [Search This Site] [Contact Form]
Copyright©2001-2024 Bucaro TecHelp 13771 N Fountain Hills Blvd Suite 114-248 Fountain Hills, AZ 85268