Home »
JavaScript
Math.atan() Method with Example in JavaScript
JavaScript | Math.atan() Method: Here, we are going to learn about the atan() method of Math class in JavaScript with Examples.
Submitted by Shivang Yadav, on December 21, 2019
JavaScript | Math.atan() Method
Math.atan() is a function in math library of JavaScript that is used to find the value of arctangent of a number.
atan(x) = arctan(x) = y => tan(y) = x
Syntax
Math.atan(p);
Parameters
- p – It represents the value whose arctangent value to be found.
Return Value
The return type of this method is number, it returns the arctangent value of the given p.
Example 1: Valid values for the method
console.log(Math.tanh(0));
console.log(Math.tanh(6));
console.log(Math.tanh(Infinity));
console.log(Math.tanh(-0.56));
console.log(Math.tanh(-Infinity));
Output
0
0.9999877116507956
1
-0.5079774328978962
-1
Example 2: Passing non-numeric values
console.log(Math.atanh("IncludeHelp"));
// Output: NaN
console.log(Math.atan(1 + 4i));
// Output: Uncaught SyntaxError: Invalid or unexpected token
JavaScript Math Object Methods »