How to use atan in JavaScript

In this article, I will explain use of atan() method in JavaScript.
  • 1763

JavaScript atan() Method

  • atan() method of math object returns the arctangent in radians of a number.

  • atan() method returns a numeric value between -pi/2 and pi/2 radians.



  • x is a Required number


In the following example show to atan() method returns the arctangent of numbers.

<!DOCTYPE html>



<h3 style="background-color:Silver">atan() Method Example</h3>

<p id="demo">Click the button to display the arctangent of the number 1</p>

<button onclick="myFunction()">Click</button>

<script type="text/javascript">

    function myFunction() {

        document.getElementById("demo").innerHTML = Math.atan(1);






atan 1.jpg


atan 2.jpg

You may also want to read these related articles here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here


More Articles

© 2020 DotNetHeaven. All rights reserved.