How to use tan in JavaScript

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

JavaScript tan() Method

  • tan() method of math object is used to get the tangent of a number.

  • In tan() method, numeric value represents the tangent of the angle.



  • x is a Required number


In the following example show to tan() method returns the tangent of numbers.





<h3 style="color:Blue">JavaScript tan() Method Example</h3>

<script type="text/javascript">

    var a = Math.tan(-30);

    document.write("First Test tan Value : " + a);

    var b = Math.tan(90);

    document.write("<br />Second Test tan Value : " + b);

    var c = Math.tan(45);

    document.write("<br />Third Test tan Value : " + c);

    var d = Math.tan(Math.PI / 180);

    document.write("<br />Fourth Test tan Value : " + d);





tan method.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.