JavaScript Tutorial





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Java-Script Tutorial
Introduction Introduction
Variables Variables
Operators Operators
Statements Statements
Loops Loops
Functions Functions
Objects Objects
Arrays Arrays
Cookies JS Cookies
Browser Objects Browser Objects
Form DOM Form DOM
Style Objects DOM Style Objects
Forums Ask Your Doubts
Scraps More about Javascript
Feedback Feedback
 

Trigonometric Methods


Tutorials Javascript

Topic

how can I calculate sin, cos and tan values in javascript?
or
what are the different trigonometric methods available in Math object?



Explanation

Object: Math

      We can also calculate trigonometrical values using the predefined math object methods or function. We can calculate sin, cos, tan, arc cosine, arc sine, arc tan values.

The get the value for angle or degree, e.g: sin(30o), convert the degree to radians when using Math.sin method. i.e: Math.sin(30*Math.PI/180).

Below table lists the methods and their usage.

ConstantExample CodeResultDescription
sin(int) Math.sin(1); Math.sin(x) where x in radians returns the sine value of x.
cos(int) Math.cos(1); Math.cos(x) returns the cosine value of x.
tan(int) Math.tan(1); Math.tan(1) returns the tangent value of x.
asin(int) Math.asin(1); Math.asin(x) returns the arc sine value of radians.
acos(int) Math.acos(1); Math.acos(x) returns the arc cosine value of radians.
atan(int) Math.atan(1); Math.atan(x) returns the arc tangent value of radians.





A Note
Javascript (JS) is one of the most used languages in the world. Some times spelled as Java Script. Hope you enjoy this tutorial. Do send your feedback or suggestions on this javascript or java script tutorial. This is a copyright content.

Other Links

web hosting