JavaScript acos() method
Example
Return the arccosine of a number:
Math.acos(0.5);
Output result:
Try it »
Definition and Usage
The acos() method returns the arccosine of a number. The returned value is an angle in radians between 0 and PI.
Note: If the parameter x is outside the range -1.0 ~ 1.0, the browser will return NaN.
Tip: If the parameter x is -1, then PI is returned.
Browser support





All major browsers support the acos() method.
Syntax
Math.acos(
x
)
Parameter value
| Parameters | Description |
|---|---|
| x | Required. Must be a number between -1.0 and 1.0. |
Return Value
| Type | Description |
|---|---|
| Number | The arccosine of x. The returned value is an angle in radians between 0 and PI. |
Technical Details
| JavaScript version: | 1.0 |
|---|
JavaScript Math object