JavaScript acos()Method

Math 对象参考手册JavaScript Math Object

Example

Returns the arccosine of a number:

Math.acos(0.5);

Output result:


Try it Yourself »

Definition and Usage

The acos() method returns the arccosine of a number. The returned value is in radians between 0 and PI.

Note:If parameter x is outside the range -1.0 to 1.0, the browser will return NaN.

Tip:If parameter x is -1, then PI will be returned.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the acos() method


Syntax

Math.acos(x)

Parameter Values

Parameter 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 in radians between 0 and PI.

Technical Details

JavaScript Version: 1.0


Math 对象参考手册JavaScript Math Object

Other Extensions