JavaScript acos() Method
THE WORLD'S LARGEST WEB DEVELOPER SITE

JavaScript acos() Method

❮ JavaScript Math Object

Example

Return the arccosine of a number:

Math.acos(0.5);
Try it Yourself »

Definition and Usage

The 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

Method
acos() Yes Yes Yes Yes Yes

Syntax

Math.acos(x)

Parameter Values

Parameter Description
x Required. A number

Technical Details

Return Value: A Number, from 0 to PI, or NaN if the value is outside the range of -1 to 1
JavaScript Version: ECMAScript 1

❮ JavaScript Math Object