Introduction to the use of Math. atan () in JavaScript
This method returns the arc tangent of radians. The atan method returns a number between-pi/2 and π/2 radian.
Syntax
The following is the detailed information about the parameters:
Return Value:
- Returns the arc tangent of a radian.
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<Html> <Head> <Title> JavaScript Math atan () Method </title> </Head> <Body> <Script type = "text/javascript"> Var value = Math. atan (-1 ); Document. write ("First Test Value:" + value ); Var value = Math. atan (. 5 ); Document. write ("<br/> Second Test Value:" + value ); Var value = Math. atan (30 ); Document. write ("<br/> Third Test Value:" + value ); Var value = Math. atan ("string "); Document. write ("<br/> Fourth Test Value:" + value ); </Script> </Body> </Html> |
This produces the following results:
1 2 3 4 |
First Test Value:-0.7853981633974483 Second Test Value: 0.4636476090008061 Third Test Value: 1.5374753309166493 Fourth Test Value: NaN |