JavaScript Math.acos()
Definition and Usage
The Math.acos() method returns the arccosine of a number as a value value between 0 and PI radians.
Note: If the parameter x is outside the range -1 to 1, the method will return NaN.
Tip: -1 will return the value of PI.
Browser Support
Math.acos()
is an ECMAScript1 (ES1) feature.
ES1 (JavaScript 1997) is fully supported in all browsers:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |
Syntax
Math.acos(x)
Parameters
Parameter | Description |
---|---|
x | Required. A number. |
Return Value
A number from 0 to PI. NaN if the value is outside the range of -1 to 1. |