tan() Method in TypeScript
-
The tan() method of the Math object is used to get the tangent of a number.
-
In the tan() method, the numeric value represents the tangent of the angle.
Syntax
- Math.tan(number);
The following example shows how to use the tan() method and it returns the tangent of numbers in radians. We use the following steps to use this method.
Step 1
Open Visual Studio 2012 and click "File" -> "New" -> "Project...". A window is opened. Give the name of your application as "tangent" and then click ok.
Step 2
After this session the project has been created; your new project should look like this:

Coding
tangent.ts
- class tangent {
- constructor() {}
- tangentofnumber() {
- for (var n = 1; n <= 10; n++) {
- var span = document.createElement("span");
- var num = Math.tan(n);
- span.style.color = "green";
- span.innerText = "Tangent of nun " + n + "->" + num.toString() + "\n";
- document.body.appendChild(span);
- }
- }
- tangentofangel() {
- for (var n = 1; n <= 6; n++) {
- var x = 30;
- var z = 30 * n;
- var span = document.createElement("span1");
- var num = Math.tan(z);
- span.style.color = "blue";
- span.innerText = "Tangent of angels " + z + "->" + num.toString() + "\n";
- document.body.appendChild(span);
- }
- }
- }
- var s = new tangent();
- s.tangentofnumber();
- s.tangentofangel();
tangentfunctiondemo.html


Sharad GuptaPosted Oct 20, 2012, 2:11 AM
nice article ........thanks