Returns the arccosine (in radians) of a number.
Method of Math
Static
Syntax
acos( x )
Parameters
Parameter | Description |
---|---|
x | A number |
Description
The acos method returns a numeric value between 0 and pi radians. If the value of number is outside this range, it returns NaN.
Because acos is a static method of Math, you always use it as Math.acos(), rather than as a method of a Math object you created.
Examples
The following function returns the arccosine of the variable x:
If you pass -1 to getAcos, it returns 3.141592653589793; if you pass 2, it returns NaN because 2 is out of range.
See also
Math.asin, Math.atan, Math.atan2, Math.cos, Math.sin, Math.tan