JavaScript acos

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

Math.acos(number);

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

acos Example

In this Math function example, we will 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>
ACOS Example