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. Otherwise, if it is outside the range -1 and 1, the acos function will return NaN.

JavaScript acos Function 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>
JavaScript ACOS Example

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.