Javascript - Math acos() Method

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

Description

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

If the parameter x is outside the range -1 to 1, the method will return NaN.

-1 will return the value of PI.

Syntax

Math.acos(x)

Parameter Values

Parameter Require Description
x Required. A number

Return

A Number, from 0 to PI, or NaN if the value is outside the range of -1 to 1

Example

Return the arccosine of a number:

Demo

//display the arccosine of 0.5

console.log(Math.acos(0.5));

Result