Others



JavaScript Math.tan()


The Math.tan(x) method returns the tangent of a number in radians.

Syntax
Math.tan(x)

Here, tan() is a static method. Hence, we use it as Math.tan().

Parameters
  • x - (Required).Angle for which we want to compute the tangent.
Return Value
  • The tangent value of the given angle.
  • NaN - non-numeric parameter.
Example
console.log(Math.tan(0));  //0
console.log(Math.tan(-2.5)); //0.7470222972386603
console.log(Math.tan(1.5)); //14.101419947171719
console.log(Math.tan('A')); //NaN
Try it Yourself