Using Math atan() function to coding in Javascript/JS

This JavaScript tutorial explains how to use the math characteristic known as atan() with syntax and examples.


In JavaScript, atan() is a function that is used to return the arc tangent (in radians) of a number. Because the atan() feature is a static feature of the Math object, it have to be invoked through the placeholder object referred to as Math.


In JavaScript, the syntax for the atan() feature is:


Parameters or Arguments

number The wide variety used to calculate the arc tangent in radians.


The atan() characteristic returns the arc tangent of a range and the result is expressed in radians.


Math is a placeholder object that includes mathematical functions and constants of which atan() is one of these functions.


Let’s take a seem at an instance of how to use the atan() characteristic in JavaScript.

For example:


In this example, we have invoked the atan() feature using the Math class.

We have written the output of the atan() characteristic to the internet browser console log, for demonstration purposes, to show what the atan() feature returns.

The following will be output to the net browser console log:


In this example, the first output to the console log returned 0.6435011087932844 which is the arc tangent of 0.75. The second output to the console log lower back -0.7328151017865066 which is the arc tangent of -0.9. The 0.33 output to the console log lower back 1.1071487177940904 which is the arc tangent of 2

The result from the atan() feature is expressed in radians.