How to use acos in JavaScript

In this article, I will explain use of acos() method in JavaScript.
  • 1780

JavaScript acos() Method

  • acos() method of math object returns the arccosine in radians of a number.

  • acos method returns a numeric value between 0 and pi radians for x between -1 and 1.

  • In acos() method, if x value of number is outside this range, it returns NaN.



  • x is a Required number


In the following example show to acos() method returns the arccosine of numbers.

<!DOCTYPE html>



<h3 style="background-color:Silver">acos() Method Example</h3>

<p id="demo">Click the button to display the arccosine of 0.8</p>

<button onclick="myFunction()">Click On</button>

<script type="text/javascript">

    function myFunction() {

        document.getElementById("demo").innerHTML = Math.acos(0.8);






acos 1.jpg 


acos 2.jpg

You may also want to read these related articles here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here


More Articles

© 2020 DotNetHeaven. All rights reserved.