Monday, November 18, 2024
Google search engine
HomeLanguagesJavascriptJavaScript Math tan() Method

JavaScript Math tan() Method

The Javas Math.tan() method in Javascript is used to return the tangent of a number. The Math. tan() method returns a numeric value that represents the tangent of the angle. The tan() is a static method of Math, therefore, it is always used as Math.tan(), rather than as a method of a Math object created.

Syntax:  

Math.tan(value)

Parameters: This method accepts a single parameter as mentioned above and described below:  

  • Value is a number representing an angle in radians.

Returns: The Math.tan() method returns the tangent of the given numbers.

Below is an example of the Math tan() Method. 

Example 1: In this example, we will pass 0 as a parameter.

Javascript




console.log("When zero is passed as a parameter: "
    + Math.tan(0));


Output

When zero is passed as a parameter: 0

Example 2: When 1 is passed as a parameter.  

Javascript




console.log("Result : " + Math.tan(1));


Output

Result : 1.5574077246549023

Example 3: When PI is passed as a parameter.

Javascript




console.log("Result : " + Math.tan(Math.PI / 4));


Output

Result : 0.9999999999999999

We have a complete list of Javascript Math Objects methods, to check those please go through this Javascript Math Object Complete reference article.

Supported Browsers: 

  • Google Chrome 1 and above
  • Firefox 1 and above
  • Opera 3 and above
  • Safari 1 and above

We have a Cheat Sheet on Javascript where we covered all the important topics of Javascript to check those please go through Javascript Cheat Sheet-A Basic guide to JavaScript.

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments