Math has a set of properties (built-in constants) including
|
E, LN10, LN2, PI, SQRT1_2, and SQRT2. For example:
|
Math.PI is equal to 3.14159É
|
Math methods include the usual ones:
|
Math.abs(x) returns the absolute value of x
|
Math.max(x1,x2) returns the maximum of x1 and x2
|
Math.cos(x) returns the cosine of x (given in radians)
|
Math.round(x) rounds x to the nearest integer
|
Math.pow(2, 0.5) is equivalent to Math.sqrt(2)
|
The Number object has properties defining system dependent constants such as:
-
Number.MAX_VALUE is largest representable number on your machine
-
Number.NaN represents "Not a Number" sometimes returned by parseInt and parseFloat
|