JavaScript acos

The JavaScript acos function a Math function that calculates the trigonometric Arc Cosine for the specified expression. The Arc Cosine also called the inverse of a COSINE Value. The syntax of the JavaScript Acos Function is

Math.acos(number);

If the number argument is not a number or outside the range -1 and 1, JavaScript acos function will return NaN.

JavaScript acos Function Example

In this Math function example, We are going to find the Arc Cosine values of different data types and display the JavaScript output.

<!DOCTYPE html>
<html>
<head>
    <title> JavaScriptACOSFunction </title>
</head>
<body>
  <h1> JavaScriptACOSFunction </h1>
  <p id = "Pos"></p>
  <p id = "Neg"></p>
  <p id = "Dec"></p>
  <p id = "Neg_Dec"></p>
  <p id = "Str"></p>
  <p id = "Exp"></p>
  <p id = "Null"></p>
  <p id = "Multi"></p>
  <p id = "Out"></p>
  <script>
    document.getElementById("Pos").innerHTML = Math.acos(1);
    document.getElementById("Neg").innerHTML = Math.acos(-1);
    document.getElementById("Dec").innerHTML = Math.acos(0.45);
    document.getElementById("Neg_Dec").innerHTML = Math.acos(-0.75);
    document.getElementById("Str").innerHTML = Math.acos("JavaScript");
    document.getElementById("Null").innerHTML = Math.acos(null);
    document.getElementById("Multi").innerHTML = Math.acos(0.25 + 0.55 - 0.77);
    document.getElementById("Out").innerHTML = Math.acos(25);
  </script>
</body>
</html>
JavaScript ACOS Function