Javascript examples for Math:acos
The acos() method returns the arccosine of a number as a value value between 0 and PI radians.
Parameter | Description |
---|---|
x | Required. A number |
A Number, from 0 to PI, or NaN if the value is outside the range of -1 to 1
The following code shows how to Return the arccosine of a number:
<!DOCTYPE html> <html> <body> <p>Click the button to display the arccosine of 0.5</p> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//w w w .ja v a 2 s. c o m document.getElementById("demo").innerHTML = Math.acos(0.5); } </script> </body> </html>