Trigonometric Methods

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


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.

Ask Questions

Ask Question