# JavaScript Math Object
● Math.round()
Math.round(x) returns the value of x rounded to its nearest integer.
● Math.pow()
Math.pow(x, y) returns the value of x to the power of y.
● Math.sqrt()
Math.sqrt(x) returns the square root of x.
● Math.abs()
Math.abs(x) returns the absolute (positive) value of x.
● Math.ceil()
Math.ceil(x) returns the value of x rounded up to its nearest integer.
● Math.floor()
Math.floor(x) returns the value of x rounded down to its nearest integer.
● Math.sin()
Math.sin(x) returns the sine ( -1 <= value <=1 ) of the angle x (radians).
If I want to use degrees instead of radians, I have to convert degrees to radians.
<Angle in radians = Angle in degrees * PI/180>
If I want to use degrees instead of radians, I have to convert degrees to radians.
<Angle in radians = Angle in degrees * PI/180>
● Math.cos()
Math.cos(x) returns the cosine of the angle x (radians).
● Math.min() and Math.max()
Math.min() and Math.max() can be used to find the lowest or highest value in a list of arguments.
● Math.random()
Math.random() returns a random number between 0, and 1.
● Math.Properties ( Constants )
JavaScript provides 8 mathematical constants that can be accessed with the Math Object.
● Math.Constructor
Unlike other global objects, the Math Object has no constructor. Methods and properties are static. All methods and properties can be used without creating a Math object first.
http://www.w3schools.com/js/js_math.asp
http://www.w3schools.com/js/js_math.asp |
No comments:
Post a Comment