Math ObjectNameMath Object---placeholder for mathematical functions and constantsSynopsis
Math.constant Math.function() Functions
DescriptionMath is a read-only reference to a placeholder object that contains mathematical functions and constants. These functions and constants are conveniently grouped by this Math object, and are invoked with syntax like this:
y = Math.sin(x); area = radius * radius * Math.PI; Math is actually a "global" property of the Window object, and as such, is usually referred to as Math, rather than as window.Math. Math is not a class of objects like Date and String are. The Date class, for example, defines methods that operate on Date objects; on instances of the class. Math, on the other hand is simply an object that contains references to functions. These functions happen to be invoked through the Math object, but they do not operate on that object, as methods would. |
|