Math Object In TypeScript: Part 4
Before reading this article, please go through the following articles:
Introduction
In this article, I am describing some of the TypeScript math functions.
In TypeScript, the sin() method is used to get the sine of a number. It returns a numeric value between -1 and 1. In this method, the numeric value represents the sine of the parameter.
Sin() Method
Syntax
- sin(number)
- Sin(num: number)
- {
- var span = document.createElement("span");
- span.innerText = "The sin value of " + num + " is -> " + Math.sin(num) + "\n";
- document.body.appendChild(span);
- }
Cos() Method
Syntax
- cos(number)
Function
- Cos(num: number)
- {
- var span = document.createElement("span");
- span.innerText = "The cos of " + num + " is -> " + Math.cos(num) + "\n";
- document.body.appendChild(span);
- }
Tan() Method
Syntax
- tan(number)
Function
- Tan(num: number) {
- var span = document.createElement("span");
- span.innerText = "The tan value of " + num + " is -> " + Math.tan(num);
- document.body.appendChild(span);
- }
Complete Program
Sin_Cos_Tan.ts



Join the conversation! Your thoughts help the community grow.