# Using Math acos() function to coding in Javascript/JS

This JavaScript tutorial explains how to use the math feature referred to as acos() with syntax and examples.

## Description

In JavaScript, acos() is a function that is used to return the arc cosine (also referred to as inverse cosine) of a number, with the result expressed in radians. Because the acos() characteristic is a static feature of the Math object, it ought to be invoked thru the placeholder object known as Math.

## Syntax

In JavaScript, the syntax for the acos() feature is:

``Math.acos(number);``

Parameters or Arguments

number The range used to calculate the arc cosine in radians. The number must be a price between 1 and -1.

## Returns

The acos() feature returns the arc cosine of a wide variety and the result is expressed in radians.

If the number is now not within the range of -1 and 1, the acos() characteristic will return NaN.

## Note

Math is a placeholder object that consists of mathematical features and constants of which acos() is one of these functions.

## Example

Let’s take a appear at an instance of how to use the acos() function in JavaScript.

For example:

``````console.log(Math.acos(0.75));
console.log(Math.acos(-0.9));
console.log(Math.acos(2));``````

In this example, we have invoked the acos() characteristic the usage of the Math class.

We have written the output of the acos() characteristic to the net browser console log, for demonstration purposes, to exhibit what the acos() function returns.

The following will be output to the web browser console log:

``````0.7227342478134157
2.6905658417935308
NaN``````

In this example, the first output to the console log again 0.7227342478134157 which is the arc cosine of 0.75. The second output to the console log again 2.6905658417935308 which is the arc cosine of -0.9. The 1/3 output to the console log lower back NaN due to the fact the quantity was now not within the vary of 1 and -1.

The result from the acos() feature is expressed in radians.