atan()
Math
class method
JS Home <<
JS Reference <<
Math <<
atan()
Description
Returns the arctangent of a number in radians between -PI
/2 and PI
/2.
- Radians to Degrees - divide number by (
Math.PI
/ 180). - Degrees to Radians - multiply number by (
Math.PI
* 180).
- Like all class methods
atan()
should be used on the class rather than an instance of the class.
Syntax
Signature | Description |
---|---|
Math.atan(value) | Returns the absolute value of a number. |
Parameters
Parameter | Description |
---|---|
value | The value you wish to find the arctangent in radians for:
|
Examples
The code below displays atan()
usage.
// Store results in an array.
var atanValues = new Array(6);
atanValues[0] = Math.atan(-1);
atanValues[1] = Math.atan(0);
atanValues[2] = Math.atan(0.75);
atanValues[3] = Math.atan(-2);
atanValues[4] = Math.atan('a string');
atanValues[5] = Math.atan();
alert(atanValues);
Related Tutorials
JavaScript Advanced Tutorials - Lesson 4 - Math