JavaScript method atan()

Ads
 

JavaScript method atan()

This section illustrates you the use of JavaScript method atan(). The atan() method returns the arc tangent of a specified number as a numeric value between -PI/2 and PI/2 radians.

This section illustrates you the use of JavaScript method atan(). The atan() method returns the arc tangent of a specified number as a numeric value between -PI/2 and PI/2 radians.

JavaScript method atan()

     

This section illustrates you the use of JavaScript method atan(). The atan() method returns the arc tangent of a specified number as a numeric value between -PI/2 and PI/2 radians. You can see in the given example that we have used the method atan() and want  to find out the arc tangent of 2. We have created a button which calls the function calculate() from the script and displays the output. 

 

 

 

Here is the code:

<html>
<script>
function calculate(){
document.write("The value of atan(2) is: "+Math.atan(2));
}
</script>
<h2>Use of atan() method</h2>
<button onclick="calculate();">Use of method atan</button>
</body>
</html>

Output will be displayed as:

On clicking the button, you will get the arc tangent of 2:

Download Source Code

     

Ads

Ads