totn JavaScript

JavaScript: Math acosh() function

This JavaScript tutorial explains how to use the math function called acosh() with syntax and examples.

Description

In JavaScript, acosh() is a function that is used to return the hyperbolic arc cosine (also called inverse hyperbolic cosine) of a number. Because the acosh() function is a static function of the Math object, it must be invoked through the placeholder object called Math.

Syntax

In JavaScript, the syntax for the acosh() function is:

Math.acosh(number);

Parameters or Arguments

number
The number used to calculate the hyperbolic arc cosine. The number must be a value greater than or equal to 1.

Returns

The acosh() function returns the hyperbolic arc cosine of a number.

If the number is less than 1, the acosh() function will return NaN.

Note

  • Math is a placeholder object that contains mathematical functions and constants of which acosh() is one of these functions.

Example

Let's take a look at an example of how to use the acosh() function in JavaScript.

For example:

console.log(Math.acosh(1));
console.log(Math.acosh(1.5));
console.log(Math.acosh(0.999));

In this example, we have invoked the acosh() function using the Math class.

We have written the output of the acosh() function to the web browser console log, for demonstration purposes, to show what the acosh() function returns.

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

0
0.9624236501192069
NaN

In this example, the first output to the console log returned 0 which is the hyperbolic arc cosine of 1. The second output to the console log returned 0.9624236501192069 which is the arc cosine of 1.5. The third output to the console log returned NaN since the number was less than 1.