Math.acos method
The Math.acos method returns
the arccosine (or inverse cosine) of
a number. The method parameter must
be between -1 to 1,
otherwise it will return NaN.
Syntax
Math.acos(number);
Example
Let's output the arccosine of
the number 0.34:
console.log(Math.acos(0.37));
The code execution result:
1.191787306098946
Example
Let's output the arccosine of
the number 1:
console.log(Math.acos(1));
The code execution result:
0
Example
The following example will output
NaN because the parameter
is greater than 1:
console.log(Math.acos(3));
The code execution result:
NaN