Math.acosh() Method with Example in JavaScript

JavaScript | Math.acosh() Method: Here, we are going to learn about the acosh() method of Math class in JavaScript with Examples.
Submitted by Shivang Yadav, on December 21, 2019

JavaScript | Math.acosh() Method

Math.acosh() is a function in math library of JavaScript that is used to find the value of hyperbolic arc-cosine of a number.

Syntax:

    Math.acosh(p);

Parameter(s):

  • p – It represents the value whose hyperbolic arc-cosine value to be found.

Return value:

The return type of this method is number, it returns the hyperbolic arc-cosine value of the given p.

Example 1: Find the acosh of numeric values

console.log(Math.acosh(1));
console.log(Math.acosh(1.454));
console.log(Math.acosh(19));

Output

0
0.9200902784327755
3.6368929184641337

Example 2: Passing numeric values that may provide invalid output.

console.log(Math.acosh(0));
console.log(Math.acosh(-1));
console.log(Math.acosh(-19));

Output

NaN
NaN
NaN

Example 3: Passing non-numeric values.

console.log(Math.acosh("Hello!"));
// Output: NaN

console.log(Math.acosh(1 + 4i));
// Outout: Uncaught SyntaxError: Invalid or unexpected token

JavaScript Math Object Methods »




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.