JavaScript Math.acos()

Examples

let x = Math.acos(-1);
Try it Yourself »
let x = Math.acos(0);
Try it Yourself »
let x = Math.acos(1);
Try it Yourself »

Description

The Math.acos() method returns the arccosine (in radians) of a number.

The Math.acos() method returns a value value between 0 and PI.

The Math.acos() method expects a parameter in the range -1 to 1.

Math.acos(-1) returns PI.

Math.acos(0) returns PI/2.

Math.acos(1) returns 0.



Syntax

Math.acos(x)
Parameter Description
x Required.
A number.

Return Value

Type Description
Number0 to PI.
NaN if the parameter is outside the range of -1 to 1 or not numeric.


Browser Support

Math.acos() is an ECMAScript1 (ES1) feature.

ES1 (JavaScript 1997) is fully supported in all browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes Yes

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.