math (JavaScript 1.0)

A built-in object that has properties and methods for mathematical constants and functions. For example, the Math object's PI property has the value of pi.

Properties & Events

KeyDescriptionAvailability
e Euler's constant and the base of natural logarithms, approximately 2.718.
chrome 1.0safari 1.0Firefox 1.0ie 3.0opera 7.0
ln10The natural logarithm of 10, approximately 2.302.
chrome 1.0safari 1.0Firefox 1.0ie 3.0opera 7.0
ln2The natural logarithm of 2, approximately 0.693.
chrome 1.0safari 1.0Firefox 1.0ie 3.0opera 7.0
log10eThe base 10 logarithm of E (approximately 0.434).
chrome 1.0safari 1.0Firefox 1.0ie 3.0opera 7.0
log2eThe base 2 logarithm of E (approximately 1.442).
chrome 1.0safari 1.0Firefox 1.0ie 3.0opera 7.0
pi The ratio of the circumference of a circle to its diameter, approximately 3.14159.
chrome 1.0safari 1.0Firefox 1.0ie 3.0opera 7.0
sqrt1_2 The square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707.
chrome 1.0safari 1.0Firefox 1.0ie 3.0opera 7.0
sqrt2The square root of 2, approximately 1.414.
chrome 1.0safari 1.0Firefox 1.0ie 3.0opera 7.0

Result from the Online TryIt-Editor
chrome 1.0safari 1.0Firefox 1.0ie 4.0opera 5.0

Examples having uses of: 'math'

1 votes
1k views

HTML5 canvas 2D

HTML5 canvas populated with one filled rectangle and one painted stroke.
0 votes
1k views

JavaScript Math Object

A javascript Math object allows us to perform the mathematical tasks.
0 votes
1k views

jQuery Animate

The jQuery animate method has a complete method we can supply with callback function that is fired once the animation is complete. This can be useful for stringing different animations together in sequence like this example.
0 votes
1k views

JavaScript Random

JavaScript random method returns a random number between 0 and 1.