Math.acos() Method - Math Functions

Math.acos() method of Math Functions in javascript.
How to get the arccosine value of a number in javascript?


Object: Math
Method: Math.acos()
Description: To get the arccosine value for a number, we use this function. The function returns a value between 0 and PI radians. The parameter for asin() function should be between -1 and 1, if it exceeds the limit it returns "NaN".


<input type=button onclick="acosine()" name="button" value="Arc Cosine">
<script type="text/javascript">
function acosine(){
val = prompt("Enter a number to get the arccosine Value:", " ");
alert('Arc cosine of the number is::'+Math.acos(val));


In the above example for Math Functions,
  • User is prompted to enter the value.
  • Math.acos() method returns the arccosine value.
  • If the radians exceeds the range -1 to 1, then returns "NaN".

Ask Questions

Ask Question