Advanced mathematical operations are provided through the Math object. : Introduction « Math « JavaScript Tutorial

Home
JavaScript Tutorial
1.Language Basics
2.Operators
3.Statement
4.Development
5.Number Data Type
6.String
7.Function
8.Global
9.Math
10.Form
11.Array
12.Date
13.Dialogs
14.Document
15.Event
16.Location
17.Navigator
18.Screen
19.Window
20.History
21.HTML Tags
22.Style
23.DOM Node
24.Drag Drop
25.Object Oriented
26.Regular Expressions
27.XML
28.GUI Components
29.Dojo toolkit
30.jQuery
31.Animation
32.MS JScript
JavaScript Tutorial » Math » Introduction 
9.1.1.Advanced mathematical operations are provided through the Math object.

The Math object is a built-in object containing properties and methods used for mathematical computation.

It is a predefined JavaScript object and can be accessed without the use of a constructor or calling method.

All Math properties and methods are static.

Properties and Methods of the Math Object

Property/MethodDescription
abs()Returns absolute value of a number
acos()Returns the arccosine of a number
asin()Returns the arcsine of a number
atan()Returns the arctangent of a number
atan2()Returns the arctangent of the quotient of its parameters
ceilReturns the smallest integer greater than or equal to a number
cos()Returns the cosine of a number
EReturns the value for Euler's constant
exp()Returns Ex, where x is a number
floor()Returns the largest integer less than or equal to a number
LN10Returns the natural logarithm of 10
LN2Returns the natural logarithm of 2
log()Returns the natural logarithm (base E) of a number
LOG10EReturns the base 10 logarithm of E
LOG2EReturns the base 2 logarithm of E
max()Returns the larger of two arguments
min()Returns the smaller of two arguments
PIReturns the value of PI
pow()Returns base to the exponent power, baseexp
random()Returns a random number between 0 and 1
round()Rounds a number to its nearest integer
sin()Returns the sine of a number
sqrt()Returns the square root of a number
SQRT1_2Returns the square root of ?
SQRT2Returns the square root of 2
tan()Returns the tangent of a number
toSource()Creates a copy of an object
toString()Returns a string representation of an object


<html>
    <body>
    <title>Example of creating a Math object</title>
    <script language="JavaScript">
    <!--
    
    var newMathObject = Math.E;
    
    document.write(newMathObject);
    
    -->
    </script>
    </body>
    </html>
9.1.Introduction
9.1.1.Advanced mathematical operations are provided through the Math object.
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.